Linux counts the number of files in a folder

Count the number of files in the folder

ll | grep ^- | wc -l

Rough statistics

ll | wc -l

Result = number of folders + number of files + 1

Count the number of folders in the folder

ll | grep ^d | wc -l

View the space occupied by a folder

du --max-depth=1 -h folder/

Find some files in the folder

find folder/ -name hello*

List files by time

ls -ltr

List files by file size

ls -lSr

Usage of wc command

Usage: wc [options] ... [file] ... 
 or: wc [options] ... –files0-from = F 
output the number of lines, word count and bytes of each specified file, if more than one file is specified, continue to Provide a total of all relevant data. If no file is specified, or the file is "-", the data is read from standard input. 
-c, –bytes output byte count statistics 
-m, –chars output character count statistics 
-l, –lines output line count statistics 
–files0-from = file reads the name terminated by NUL from the specified file if the file is specified For "-", read the file name from standard input 
-L, –max-line-length displays the length of the longest line 
-w, –words displays the word count 
–help displays this help information and exits 
–version displays version information and exit

reference

  • man toilet
Published 190 original articles · praised 497 · 2.60 million views +

Guess you like

Origin blog.csdn.net/u013066730/article/details/105439263