Sometimes you need to see how many files are in the folder, so you need to use the following instructions
$ls-L | Grep-c ' ^-'
What does a grep mean? We're man.
$man grep
You will see the following description:
Synopsis
grep [OPTIONS] pattern [FILE ...]
grep [OPTIONS] [e-pattern |-f file] [file ...]
DESCRIPTION
grep searches the named input files (or standard input if no files are
named, Or if a single hyphen-minus (-) are given as file name for lines
containing a match to the given pattern. By default, grep prints the matching lines.
Is that the white is to print out and in the file to find and pattern the same keyword, and then print out the line, the other options parameters please use the man command to view,-C is not directly printed, but statistics line number, then "^-" this is what meaning it.
Linux common file types are: Ordinary files, directory files, character device files and block device files, symbolic link files, including:
1 Normal file file permissions The first character is "-"
2 directory Files file permissions The first character is "D"
3 File permissions for character device files The first character is "C"; file
permissions for 4-block device files The first character is the file permissions for the "B"
5 symbolic Link File The first character is "s"
Then I understand, in fact, is to count the number of ordinary documents BAI, the same can be ~
# Number of statistical catalogs
$ls-l | grep-c ' ^d '
I want to count it recursively. Then change the ls-l to LS-LR on the line ~ ~
(end)