Command summary

alias assigns an alias for commands, files or devices. Only available in the C shell.

cat concatenates (joins) files and lists the result. Often used to direct the contents of a single file to the standard output.


-n numbers the lines in the file(s)

-s eliminates consecutive blank lines

Example: % cat file1 file2 > file3

cd [directory] changes current working directory. (Default is home directory.)

Example: % cd /usr/etc

chmod mode file changes permissions of files and directories. Mode consists of three elements: [ugoa] [+-=] [rwxs]

Example: % chmod g+r project (adds read permission to group)

cmp compares two files and prints the line number and character where they differ.

Example: % cmp file1 file2

comm compares two files for common lines.

-1 suppresses lines that only occur in file1

-2 suppresses lines that only occur in file2

-3 suppresses lines that only occur in one file

cp makes a copy of a file.


-i interactive mode (to protect destination file if it already exists)

Example: % cp -i file1 file2

date gives time and date

diff lists differences in two files or directories.


-b ignores trailing blanks

-e prints ed changes needed to make files identical

ed accesses the ed line editor

grep searches a file for a pattern (see chapter 15)

head -n Prints first n lines

jobs lists the background jobs.


-1 displays process id

kill terminates background job

ln -s sets up a symbolic link to a file or directory.

Example: ln -s /usr/games fun

ls lists files in a directory (default current directory)


-a all files (including hidden files)

-c in order of creation time

-g give group identity

-l in long format

-s sorted by block size

-t sorted by modification time

-u sorted by last access time

mail receives and sends mail

mkdir creates a directory

more lists the contents of a file a page at a time.

mv moves a file. Often used to simply rename a file.


-i interactive mode to protect destination file if it already exists

passwd change passwd

pg pager available on some systems

pr formats and outputs a file.


-ln where n is the page length (default 66)

-wn where n is the page width (default 72)

-n no. of columns

-hstring defines the header name as string

pwd displays name of current directory

rm deletes files


-i interactive prompt to protect files

rmdir delete directory (only works on empty directories).

sort sorts and merges files.


-b ignores blanks

-d dictionary order

-f fold upper to lower case

-i ignores characters outside the printable ASCII set

-n sorts numbers by value

-o directs output to a file

-r sorts in reverse order

spell checks spelling in a file

tail n lists the last n lines of a file if n is negative, or starts listing on the nth line, if n is positive

time displays the execution time of a command

unalias removes a previously defined alias

vi accesses the vi screen editor

wc counts the number of lines, words and characters in a file


-c counts only characters

-w counts only words

-l counts only lines

who who is logged on

write direct communications to users on the same machine