oreilly.comSafari Books Online.Conferences.


Linux in a Nutshell

This directory of Linux commands is from Linux in a Nutshell, 5th Edition.

Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.

Buy it now, or read it online on Safari Bookshelf.


cmp [options] file1 file2 [skip1 [skip2] ]

Compare file1 with file2. Use standard input if file1 is - or missing. This command is normally used for comparing binary files, although files can be of any type. (See also diff.) skip1 and skip2 are optional offsets in the files at which the comparison is to start.


-c, --print-chars

Print differing bytes as characters.

-i num, --ignore-initial=num

Ignore the first num bytes of input.

-l, --verbose

Print offsets and codes of all differing bytes.

-s, --quiet, --silent

Work silently; print nothing, but return exit codes:


Files are identical.


Files are different.


Files are inaccessible.


Print a message if two files are the same (exit code is 0):

cmp -s old new && echo 'no changes'

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: