Ls-L | grep \ "^-\" | WC-l
Or
Find./company-type F | WC-l
View the number of files in a folder, including files in subfolders.
Ls-LR | grep \ "^-\" | WC-l
View the number of folders in a folder, including those in subfolders.
Ls-LR | grep \ "^ d \" | WC-l
Note:
Ls-l
Long list output file information under this directory (note that the files here, unlike general files, may be directories, links, device files, etc)
Grep \ "^ -\"
[Note] \ '-\' is a minus sign rather than an underscore !!!
Here, the output information of the long list is filtered out, and only general files are retained. If only directories are retained, ^ d is used.
WC-l
Count the number of rows of output information. Because only common files are filtered out, the statistical result is the number of rows of general files.
A row of Information corresponds to a file, which is the number of files.
View the folder size in Linux
View the current folder size in Du-SH
Du-sh * | sort-N: Count the current folder (directory) size and sort by file size
Du-SK filename: view the specified file size