Home  >  Article  >  Operation and Maintenance  >  How to check the number of lines, words and characters of a file in Linux

How to check the number of lines, words and characters of a file in Linux

王林
王林Original
2019-12-27 11:46:346736browse

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

How to check the number of lines, words and characters of a file in Linux

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

How to check the number of lines, words and characters of a file in Linux

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

How to check the number of lines, words and characters of a file in Linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn