The wc command in Linux and other Unix-like systems like FreeBSD is used to count the number of lines, words, and characters in a file or input. It is a simple yet powerful tool that can be used for a variety of tasks, such as counting the number of words in a document, checking the size of a file, or even finding the number of lines in a log file.

The basic syntax for wc is:

wc [options] file

Where file is the file or input you want to count, and options are any options that modify the behavior of the command.

Examples:

To count the number of lines, words, and characters in a file:

wc file.txt

To count only the number of lines in a file:

wc -l file.txt

To count the number of words in a file:

wc -w file.txt

To count the number of characters in a file:

wc -m file.txt

Example of the output for all the above commands, using /etc/passwd instead of file.txt:

$ wc /etc/passwd
      39     104    2261 /etc/passwd
      
$ wc -l /etc/passwd
      39 /etc/passwd
      
$ wc -w /etc/passwd
     104 /etc/passwd
     
$ wc -m /etc/passwd
    2261 /etc/passwd

To count the number of lines, words, and characters in input from the command line:

echo "hello world" | wc

Output:

$ echo "hello world" | wc
       1       2      12

The wc command supports a variety of options and switches that allow you to customize its behavior. Some of the most commonly used options include -l (to display the number of lines), -w (to display the number of words) and -m (to display the number of characters).

In summary, the wc command is a simple yet powerful tool that allows you to count the number of lines, words, and characters in a file or input. By understanding the basic syntax and options, you can easily count the number of words in a document, check the size of a file or even find the number of lines in a log file.