In Linux, you can use the ls command to check how many files there are. This command is used to display the contents of the specified directory. When the parameter is set to "wc -c", the number of files in the directory can be displayed. The syntax is "ls directory path | wc -c"; you can use "sudo ls /* | wc -c" to view the number of directories on the entire computer.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
If you want to check the number of entire directories on your computer, enter the command:
ls /* | wc -c
If you want to check the files in a certain directory, use the Just enter the command. That is, add the directory path after [ls]. For example, the root directory here [[ls / | wc -c].
The example is as follows:
If you want to view the number of entire directories on your computer, enter the command :
sudo ls /* | wc -w
At this time, all directories on the computer will be listed.
Analysis:
ls the current directory, given to the wc command, -w means words, so this command counts the current files and folders
The example is as follows:
Recommended learning: Linux video tutorial
The above is the detailed content of How to check how many files there are in linux. For more information, please follow other related articles on the PHP Chinese website!