Home > Article > Operation and Maintenance > How to check how many lines a file has in Linux
Linux method to check how many lines a file has: 1. Log in to the Linux system and right-click on a blank space on the system desktop; 2. In the pop-up drop-down option, click the "Open Terminal" option; 3. In the opened terminal, execute the "wc -l filename" command to view it.
#The operating environment of this tutorial: Red Hat Enterprise Linux 6.1 system, Dell G3 computer.
How to check how many lines a file has in Linux
1. Log in to the Linux system and right-click on a blank space on the Linux desktop.
2. In the pop-up drop-down option, click to open the terminal.
3. Execute the following command in the terminal to view the number of lines in the file.
wc -l filename
Description:
The Linux wc command is used to calculate the word count.
wc -l filename
is to check how many lines there are in the file.
#wc -w filename
See how many words there are in the file.
wc -L filename
How many words are there in the longest line in the file.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to check how many lines a file has in Linux. For more information, please follow other related articles on the PHP Chinese website!