Linux Comm Wc
# Linux wc Command
[ Linux Command Manual](#)
The Linux wc command is used to count words.
Using the wc command, we can calculate the number of bytes, words, or lines in a file. If no file name is specified, or if the given file name is "-", the wc command reads data from the standard input device.
### Syntax
wc [file...]
**Parameters**:
* -c or --bytes or --chars Display only the byte count.
* -l or --lines Display the line count.
* -w or --words Display only the word count.
* --help Online help.
* --version Display version information.
### Example
By default, wc calculates the number of lines, words, and bytes in the specified file. The command used is:
wc testfile
First, view the contents of the testfile file:
$ cat testfile Linux networks are becoming more and more common, but scurity is often an overlooked issue. Unfortunately, in todayβs environment all networks are potential hacker targets, fro0m tp-secret military research networks to small home LANs. Linux Network Securty focuses on securing Linux in a networked environment, where the security of the entire network needs to be considered rather than just isolated machines. It uses a mix of theory and practicl techniques to teach administrators how to install and use security applications, as well as how the applcations work and why they are necesary.
### Using wc to count, the result is as follows:
$ wc testfile # Statistics for testfile file 3 92 598 testfile # testfile file has 3 lines, 92 words, 598 bytes
Here, the 3 numbers represent the number of lines, words, and bytes in the testfile file, respectively.
If you want to count information for multiple files at the same time, for example, counting testfile, testfile_1, and testfile_2 simultaneously, you can use the following command:
wc testfile testfile_1 testfile_2 #Count information for three files
The output result is as follows:
$ wc testfile testfile_1 testfile_2 #Count information for three files 3 92 598 testfile #First file has 3 lines, 92 words, 598 bytes 9 18 78 testfile_1 #Second file has 9 lines, 18 words, 78 bytes 3 6 32 testfile_2 #Third file has 3 lines, 6 words, 32 bytes 15 116 708 total #Total for three files: 15 lines, 116 words, 708 bytes
[ Linux Command Manual](#)
YouTip