[Next] [Previous] [Up] [Top] [Contents]

CHAPTER 8 Other Useful Commands

8.1 Working With Files

This section will describe a number of commands that you might find useful in examining and manipulating the contents of your files.

File utilities
Command/SyntaxWhat it will do
cmp [options] file1 file2compare two files and list where differences occur (text or binary files)
cut [options] [file(s)]cut specified field(s)/character(s) from lines in file(s)
diff [options] file1 file2compare the two files and display the differences (text files only)
file [options] fileclassify the file type
find directory [options] [actions]find files matching a type or pattern
ln [options] source_file targetlink the source_file to the target
paste [options] filepaste field(s) onto the lines in file
sort [options] filesort the lines of the file according to the options chosen
strings [options] filereport any sequence of 4 or more printable characters ending in <NL> or <NULL>. Usually used to search binary files for ASCII strings.
tee [options] filecopy stdout to one or more files
touch [options] [date] filecreate an empty file, or update the access time of an existing file
tr [options] string1 string2translate the characters in string1 from stdin into those in string2 in stdout
uniq [options] fileremove repeated lines in a file
wc [options] [file(s)]display word (or character or line) count for file(s)

8.1.1 - cmp - compare file contents
8.1.2 - diff - differences in files
8.1.3 - cut - select parts of a line
8.1.4 - paste - merge files
8.1.5 - touch - create a file
8.1.6 - wc - count words in a file
8.1.7 - ln - link to another file
8.1.8 - sort - sort file contents
8.1.9 - tee - copy command output
8.1.10 - uniq - remove duplicate lines
8.1.11 - strings - find ASCII strings
8.1.12 - file - file type
8.1.13 - tr - translate characters
8.1.14 - find - find files

Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]