1.12. Unix Command Quick Reference

Table 1.7, “Unix Commands” provides a quick reference for looking up common Unix commands. For details on any of these commands, run man command (or info command on some systems).

Table 1.7. Unix Commands

SynopsisDescription
ls [file|directory]List file(s)
cp source-file destination-fileCopy a file
cp source-file [source-file ...] directoryCopy multiple files to a directory
mv source-file destination-fileRename a file
mv source-file [source-file ...] directoryMove multiple files to a directory
ln source-file destination-fileCreate another name for the same file. (source and destination must be in the same file system)
ln -s source destinationCreate a symbolic link to a file or directory
rm file [file ...]Remove one or more files
rm -r directoryRecursively remove a directory and all of its contents
srm file [file ...]Securely erase and remove one or more files
mkdir directoryCreate a directory
rmdir directoryRemove a directory (the directory must be empty)
find start-directory criteriaFind files/directories based on flexible criteria
makeRebuild a file based on one or more other files
od/hexdumpShow the contents of a file in octal/hexadecimal
awkProcess tabular data from a text file
sedStream editor. Echo files, making changes to contents.
sortSort text files based on flexible criteria
uniqEcho files, eliminating adjacent duplicate lines.
diffShow differences between text files.
cmpDetect differences between binary files.
cdiffShow differences between C programs.
cutExtract substrings from text.
m4Process text files containing m4 mark-up.
chfnChange finger info (personal identity).
chshChange login shell.
suSubstitute user.
cc/gcc/iccCompile C programs.
f77/f90/gfortran/ifortCompile Fortran programs.
arCreate static object libraries.
indentBeautify C programs.
astyleBeautify C, C++, C#, and Java programs.
tarPack a directory tree into a single file.
gzipCompress files.
gunzipUncompress gzipped files.
bzip2Compress files better (and slower).
bunzip2Uncompress bzipped files.
zcat/zmore/zgrep/bzcat/bzmore/bzgrepProcess compressed files.
exec commandReplace shell process with command.
dateShow the current date and time.
calPrint a calendar for any month of any year.
bcUnlimited precision calculator.
printenvPrint environment variables.