Unix Command Summary

In the table below we summarize the more frequently used commands on a Unix system. In this table, as in general, for most Unix commands, file, could be an actual file name, or a list of file names, or input/output could be redirected to or from the command.

awk/nawk [options] file

Scan for patterns in a file and process the results.

cat [options] file

Concatenate (list) a file.

cd [directory]

Change directory.

chgrp [options] group file

Change the group of the file.

chmod [options] file

Change file or directory access permissions.

chown [options] owner file

Change the ownership of a file; can only be done by the superuser.

chsh (passwd -e/-s) username login_shell

Change the user's login shell (often only by the superuser).

cmp [options] file1 file2

Compare two files and list where differences occur (text or binary files).

compress [options] file

Compress file and save it as file.Z

cp [options] file1 file2

Copy file1 into file2; file2 shouldn't already exist. This command creates or overwrites file2.

cut (options) [file(s)]

Cut specified field(s)/character(s) from lines in file(s).

date [options]

Report the current date and time.

dd [if=infile] [of=outfile] [operand=value]

Copy a file, converting between ASCII and EBCDIC or swapping byte order, as specified.

diff [options] file1 file2

Compare the two files and display the differences (text files only).

df [options] [resource]

Report the summary of disk blocks and inodes free and in use.

du [options] [directory or file]

Report amount of disk space in use.

echo [text string]

Echo the text string to stdout.

ed or ex [options] file

Unix line editors.

emacs [options] file

Full-screen editor.

expr arguments

Evaluate the arguments. Used to do arithmetic, etc. in the shell.

file [options] file

Classify the file type.

find directory [options] [actions]

Find files matching a type or pattern.

finger [options] user[@hostname]

Report information about users on local and remote machines.

ftp [options] host

Transfer file(s) using file transfer protocol.

grep [options] 'search string' argument
egrep [options] 'search string' argument
fgrep [options] 'search string' argument

Search the argument (in this case probably a file) for all occurrences of the search string, and list them.

gzip [options] file
gunzip [options] file
zcat [options] file

Compress or uncompress a file. Compressed files are stored with a .gz ending.

head [-number] file

Display the first 10 (or number of) lines of a file.

hostname

Display or set (super-user only) the name of the current machine.

kill [options] [-SIGNAL] [pid#] [%job]

Send a signal to the process with the process id number (pid#) or job control number (%n). The default signal is to kill the process.

ln [options] source_file target

Link the source_file to the target.

lpq [options]
lpstat [options]

Show the status of print jobs.

lpr [options] file
lp [options] file

Print to defined printer.

lprm [options]
cancel [options]

Remove a print job from the print queue.

ls [options] [directory or file]

List directory contents or file permissions.

mail [options] [user]
mailx [options] [user]
Mail [options] [user]

Simple email utility available on Unix systems. Type a period as the first character on a new line to send message out, question mark for help.

man [options] command

Show the manual (man) page for a command.

mkdir [options] directory

Make a directory.

more [options] file
less [options] file
pg [options] file

Page through a text file.

mv [options] file1 file2

Move file1 into file2.

od [options] file

Octal dump a binary file, in octal, ASCII, hex, decimal, or character mode.

passwd [options]

Set or change your password.

paste [options] file

Paste field(s) onto the lines in file.

pr [options] file

Filter the file and print it on the terminal.

ps [options]

Show status of active processes.

pwd

Print working (current) directory.

rcp [options] hostname

Remotely copy files from this machine to another machine.

rlogin [options] hostname

Login remotely to another machine.

rm [options] file

Remove (delete) a file or directory (-r recursively deletes the directory and its contents) (-i prompts before removing files).

rmdir [options] directory

Remove a directory.

rsh [options] hostname

Remote shell to run on another machine.

script file

Saves everything that appears on the screen to file until exit is executed.

sed [options] file

Stream editor for editing files from a script or from the command line.

sort [options] file

Sort the lines of the file according to the options chosen.

source file . file

Read commands from the file and execute them in the current shell. source: C shell, .: Bourne shell.

strings [options] file

Report any sequence of 4 or more printable characters ending in or . Usually used to search binary files for ASCII strings.

stty [options]

Set or display terminal control options.

tail [options] file

Display the last few lines (or parts) of a file.

tar key[options] [file(s)]

Tape archiver--refer to man pages for details on creating, listing, and retrieving from archive files. Tar files can be stored on tape or disk.

tee [options] file

Copy stdout to one or more files.

telnet [host [port]]

Communicate with another host using telnet protocol.

touch [options] [date] file

Create an empty file, or update the access time of an existing file.

tr [options] string1 string2

Translate the characters in string1 from stdin into those in string2 in stdout.

uncompress file.Z

Uncompress file.Z and save it as a file.

uniq [options] file

Remove repeated lines in a file.

uudecode [file]

Decode a uuencoded file, recreating the original file.

uuencode [file] new_name

Encode binary file to 7-bit ASCII, useful when sending via email, to be decoded as new_name at destination.

vi [options] file

Visual, full-screen editor.

wc [options] [file(s)]

Display word (or character or line) count for file(s).

whereis [options] command

Report the binary, source, and man page locations for the command named.

which command

Reports the path to the command or the shell alias in use.

who or w

Report who is logged in and what processes are running.

zcat file.Z

Concatenate (list) uncompressed file to screen, leaving file compressed on disk.

Copyright © 1996 by Frank Fiamingo, Linda DeBula and Linda Condron, University Technology Services, The Ohio State University, 406 Baker Systems, 1971 Neil Avenue, Columbus, OH 43210.

Last update: 2019-02-13T00:24:41+00:00