Linux Command Directory
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.
wc [options] [files]
Print byte, word, and line counts for each file. Print a total line for multiple files. If no files are given, read standard input. See other examples under ls and sort.
Print byte count only.
Print line count only.
Print length of longest line.
Print character count only.
Print word count only.
Print help message and then exit.
Print the version number and then exit.
Count the number of users logged in:
who | wc -l
Count the words in three essay files:
wc -w essay.
Count lines in the file named by variable $file (don't display filename):
wc -l < $file