|
first displays what occurs in first files but not in the second
second displays what occurs in second file but not in first
third displays what is common in both files
continue statement The rest of the commands in the loop are ignored. It moves out of the loop and moves on the next cycle.
cp The cp (copy) command is used to copy a file.
Cp [filename1] [filename2]
cpio(copy input/output) Utility program used to take backups.
Cpio operates in three modes:
-o output
-i input
-p pass
creat()
the system call creates a new file or prepares to rewrite an existing file. The file pointer is set to the beginning of file.
#include<sys/tyes.h>
#include<sys/stat.h>
int creat(path, mode)
char *path;
int mode;
cut used to cut out parts of a file. It takes filenames as command line arguments or input from standard input. The command can cut columns as well as fields in a file. It however does not delete the selected parts of the file.
Cut [-ef] [column/fie,d] filename
Cut-d “:” –f1,2,3 filename
Where –d indicates a delimiter specified within “:”
df used to find the number of free blocks available for all the mounted file systems.
#/etc/df [filesystem]
diff the diff command compares text files. It gives an index of all the lines that differ in the two files along with the line numbers. It also displays what needs to be changed.
Diff filename1 filename2
echo The echo command echoes arguments on the command line.
echo [arguments]
env Displays the permanent environment variables associated with a user’s login id
exit command Used to stop the execution of a shell script.
expr command Expr (command) command is used for numeric computation.
The operators + (add), -(subtract), *(multiplu), /(divide), (remainder) are allowed. Calculation are performed in order of normal numeric precedence.
find The find command searches through directories for files that match the specified criteria. It can take full pathnames and relative pathnames on the command line.
To display the output on screen the –print option must be specified
for operator The for operator may be used in looping constructs where there is repetitive execution of a section of the shell program.
For var in vall val2 val3 val4;
Do commnds; done
fsck Used to check the file system and repair damaged files. The command takes a device name as an argument
# /etc/fsck /dev/file-system-to-be-checked.
grave operator Used to store the standard the output of a command in an enviroment variable. (‘)
grep The grep (global regular expression and print) command can be used as a filter to search for strings in files. The pattern may be either a fixed character string or a regular expression.
Grep “string” filename(s)
HOME User’s home directory
if operator The if operator allows conditional operator
If expression; then commands; fi
if … then…else… fi
$ if; then
commands
efile; then
commands
fi
kill used to stop background processes
in used to link files. A duplicate of a file is created with another name
LOGNAME displays user’s login name
ls Lists the files in the current directory
Some of the available options are:
-l gives a long listing
-a displays all file{including hidden files
lp used to print data on the line printer.
Lp [options] filename(s)
|