Home >Operation and Maintenance >Linux Operation and Maintenance >How to check the number of lines, words and characters of a file in Linux
To count the number of file lines, take the statistics of the system install.log file line number as an example.
Command to count the number of lines in the install.log file:
wc -l install.log
or
cat install.log | wc -l
Related learning video tutorial sharing: Linux video tutorial
Count the number of words, still taking the install.log file as an example.
Command to count the number of words in the install.log file:
wc -w install.log
or
cat install.log | wc -w
Count the number of characters. Still taking the install.log file as an example.
Command to count the number of characters in the install.log file:
wc -c install.log
or
cat install.log | wc -c
Recommended related article tutorials: linux Tutorial
The above is the detailed content of How to check the number of lines, words and characters of a file in Linux. For more information, please follow other related articles on the PHP Chinese website!