Home > Operation and Maintenance > Linux 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

王林
Release: 2019-12-27 11:46:34
Original
6816 people have browsed it

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
Copy after login

or

cat install.log | wc -l
Copy after login

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
Copy after login

or

cat  install.log | wc -w
Copy after login

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
Copy after login

or

cat install.log | wc -c
Copy after login

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template