-Displays the "number of lines", "number of words", and "number of bytes" of the file.
$wc
$ $wc /etc/passwd
Execution result
[hkoen@localhost ~]$ wc /etc/passwd
44 101 2433 /etc/passwd
44: Number of lines 101: Number of words 2433: Number of bytes
・ -L: Only the number of lines ・ -W: Only the number of words -C: Only the number of bytes
Execution result(-l)
[hkoen@localhost ~]$ wc -l /etc/passwd
44 /etc/passwd
The procedure for counting the number of lines with wc -l is It is often used before cating or greping a file whose contents are unknown. If you suddenly cat or grep a file you do not know, This is because there is a risk that a huge number of lines will be output on the terminal.
It is also used for log analysis purposes in combination with grep with specific wording. It is also useful for investigating the number of accesses to a specific application on the WEB server and investigating the result of batch processing.
Recommended Posts