[miaomiao@localhost test2]$ ls
t1 t11 t2 t22 t3 tt
[miaomiao@localhost test2]$ ls -lR|grep "^d"|wc -l ---四个文件夹
4
[miaomiao@localhost test2]$ ls -l|grep "^-"|wc -l ----两个文件
2
[miaomiao@localhost test2]$ cd t1
[miaomiao@localhost t1]$ touch ttt
[miaomiao@localhost t1]$ ls
ttt ------在t1里面新建一个文件
[miaomiao@localhost t1]$ cd ..
[miaomiao@localhost test2]$ ls
t1 t11 t2 t22 t3 tt
[miaomiao@localhost test2]$ ls -l|grep "^-"|wc -l --- ----两个文件
2
[miaomiao@localhost test2]$ ls -lR|grep "^-"|wc -l
3 - --- ----三个文件(包括子目录里面的) 下面的同理,是关于文件夹的 理解(R,-/d)
[miaomiao@localhost test2]$ cd t1
[miaomiao@localhost t1]$ mkdir mmmm
[miaomiao@localhost t1]$ ls
mmmm ttt
[miaomiao@localhost t1]$ cd ..
[miaomiao@localhost test2]$ ls
t1 t11 t2 t22 t3 tt
[miaomiao@localhost test2]$ ls -lR|grep "^d"|wc -l
5
[miaomiao@localhost test2]$ ls -l|grep "^d"|wc -l
4