| Command |
Description |
Examples |
| cat |
Concatenate and display
files |
$ cat dante
The Life and Times of Dante
by Dante Pocai
Mention "Alighieri" and
few may know about whom you
are talking. Say "Dante," instead, and the whole world
knows whom you mean. For Dante Alighieri, like Raphael
$ |
| diff |
The diff utility will
compare the contents of 2 files and write to standard output a list
of changes necessary to convert the first file into the second
file. No output will be produced if the files are identical. |
$ diff -c fruit fruit2
*** fruit Fri May 8 11:32:49 1998
--- fruit2 Fri May 8 14:55:21 1998
***********
***2, 8****
orange
apple
banana
-pear
-mango
tomato
pomegranate
---2, 8-----
orange
apple
banana
tomato
+guava
+mango
pomegranate |
| file |
Determines file type |
$ file dante
dante: English text
$ file beans
beans: Frame Maker Document |
| head |
Displays the first few
lines of files. |
$ head -5 /usr/dict/words
1st
2nd
3rd
4th
5th
$ |
| mkdir |
The mkdir command creates the named directories in
mode 777 (possibly altered by the file mode creation mask umask(1)). |
$ mkdir Reports
$ ls -dl Reports
drwxr-xr-x 2 user2 staff 512 Jan 28 16:24 Reports
$ mkdir -p practice/dir1/admin
$ ls -R practice
practice:
dir1 mailbox project research
practice/dir1:
admin
practice/dir1/admin: |
| more |
The more utility is a
filter that displays the contents of a text file on the terminal, on
screen at a time. It normally pauses after each full
screen. |
$ cat dante | more |
| ls |
For each file
that is a directory, ls lists the contents of the directory; for
each file that is an ordinary file, ls repeats its name and any
other information requested. |
-a,-F,-l,-lt,-ld,-E
$ ls /home/user2
<output omitted>
$ ls -l /home/user2/dir2
<output omitted>
$ ls -la ~/dir1
<output omitted>
|
| strings |
Finds printable strings in an object or binary file |
$ strings /usr/bin/cat
SUNW_OST_OSCMD
usvtebn
usage: cat [ -usvtebn ] [-|file] ...
cat: Cannot stat stdout
cat: cannot open %s
cat: cannot stat %s
cat: input/output files '%s' identical
cat: close error
<some output omitted> |
| tail |
Displays the last few
lines of files. |
$ tail -5 /usr/dict/words
zounds
z's
zucchini
Zurich
zygote
$ |
| touch |
The touch utility sets the access and modification
times of each file. The file is created if it does not already
exist |
$ cd ~/practice
$ touch mailbox project research
$ ls
mailbox project research |
| wc |
The wc utility reads one
or more input files and, by default, writes the number of newline
characters, words, and bytes contained in each input file to the
standard output. |
$ wc dante
33 223 1320 dante
$ wc -l dante
33 dante |