1. 查看root目录
[root@portal /]# cd /root/
[root@portal ~]# ll
总用量 8
-rw-------. 1 root root 1588 11月 11 23:54 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 11月 20 05:48 appendonly.aof
-rw-r--r--. 1 root root 1636 11月 12 00:11 initial-setup-ks.cfg
drwxr-xr-x. 2 root root 6 11月 12 00:17 公共
drwxr-xr-x. 2 root root 6 11月 12 00:17 模板
drwxr-xr-x. 2 root root 6 11月 12 00:17 视频
drwxr-xr-x. 2 root root 6 11月 12 00:17 图片
drwxr-xr-x. 2 root root 6 11月 12 00:17 文档
drwxr-xr-x. 2 root root 6 11月 12 00:17 下载
drwxr-xr-x. 2 root root 6 11月 12 00:17 音乐
drwxr-xr-x. 2 root root 6 11月 12 00:17 桌面
[root@portal ~]#
2. 查看文件个数
[root@portal ~]# ll | grep '^-'
-rw-------. 1 root root 1588 11月 11 23:54 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 11月 20 05:48 appendonly.aof
-rw-r--r--. 1 root root 1636 11月 12 00:11 initial-setup-ks.cfg
[root@portal ~]# ll | grep '^-' | wc -l
3
3. 查看文件夹个数
[root@portal ~]# ll | grep '^d'
drwxr-xr-x. 2 root root 6 11月 12 00:17 公共
drwxr-xr-x. 2 root root 6 11月 12 00:17 模板
drwxr-xr-x. 2 root root 6 11月 12 00:17 视频
drwxr-xr-x. 2 root root 6 11月 12 00:17 图片
drwxr-xr-x. 2 root root 6 11月 12 00:17 文档
drwxr-xr-x. 2 root root 6 11月 12 00:17 下载
drwxr-xr-x. 2 root root 6 11月 12 00:17 音乐
drwxr-xr-x. 2 root root 6 11月 12 00:17 桌面
[root@portal ~]# ll | grep '^d' | wc -l
8
4. wc命令
语法:
wc [-clw][–help][–version][文件…]
参数:
-c或–bytes或–chars 只显示Bytes数。
-l或–lines 显示行数。
-w或–words 只显示字数。
–help 在线帮助。
–version 显示版本信息
5. grep命令
Linux grep 命令用于查找文件里符合条件的字符串,是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来