linux命令深度使用 – ls
2017-12-17 16:47
411 查看
1 linux命令深度使用 – ls
ls命令是linux系统中最被频繁使用的命令之一, 可查看目录或文件相关信息。1.1不带任何参数
1. # ls2. doc1 doc2 file1.txt file2.txt link1
1.2带参数 –l
1. # ls -l2. drwxr-xr-x2 root root 80 Dec 17 13:49 doc1
3. drwxr-xr-x2 root root 80 Dec 17 13:25 doc2
4. -rw-r--r--1 root root 1315 Dec 17 13:48 file1.txt
5. -rw-r--r--1 root root 1499 Dec 17 13:48 file2.txt
6. lrwxrwxrwx1 root root 9 Dec 17 13:49 link1 -> file1.txt
1.3带参数 –lh
1. # ls -lh2. drwxr-xr-x2 root root 80 Dec 17 13:49 doc1
3. drwxr-xr-x2 root root 80 Dec 17 13:25 doc2
4. -rw-r--r--1 root root 1.3K Dec 17 13:48 file1.txt
5. -rw-r--r--1 root root 1.5K Dec 17 13:48 file2.txt
6. lrwxrwxrwx1 root root 9 Dec 17 13:49 link1 -> file1.txt
按照便于人识别的格式显示,比如1K, 1M, 1G
1.4显示隐藏文件
1. # ls -la2. drwxr-xr-x4 root root 160 Dec 17 13:51 .
3. drwxrwxrwt12 root root 5540 Dec 17 14:10 ..
4. -rw-r--r--1 root root 0 Dec 17 13:51 .tmp.log
5. drwxr-xr-x2 root root 80 Dec 17 13:49 doc1
6. drwxr-xr-x2 root root 80 Dec 17 13:25 doc2
7. -rw-r--r--1 root root 1315 Dec 17 13:48 file1.txt
8. -rw-r--r--1 root root 1499 Dec 17 13:48 file2.txt
9. lrwxrwxrwx1 root root 9 Dec 17 13:49 link1 -> file1.txt
可以看出多显示了.tmp.log
1.5文件倒序排序
1. # ls -r2. link1file2.txt file1.txt doc2 doc1
可以跟ls命令显示对比。
1.6目录后加/显示
1. # ls -p2. doc1/ doc2/ file1.txt file2.txt link1
1.7非文件显示后缀
1. # ls -F2. doc1/ doc2/ file1.txt file2.txt link1@
目录多出/ ,链接多出@
1.8递归显示子目录
1. # ls -R2. .:
3. doc1 doc2 file1.txt file2.txt link1
4.
5. ./doc1:
6. file1.txt file2.txt
7.
8. ./doc2:
9. file1 file2
1.9按大小排序
1. # ls -S2. file2.txt file1.txt doc1 doc2 link1
1.10 修改时间倒序列出
1. # ls -ltr2. drwxr-xr-x2 root root 80 Dec 17 13:25 doc2
3. -rw-r--r--1 root root 1315 Dec 17 13:48 file1.txt
4. -rw-r--r--1 root root 1499 Dec 17 13:48 file2.txt
5. lrwxrwxrwx1 root root 9 Dec 17 13:49 link1 -> file1.txt
6. drwxr-xr-x2 root root 80 Dec 17 13:49 doc1
1.11 显示UID和GID
1. # ls -n2. drwxr-xr-x2 0 0 80 Dec 17 13:49 doc1
3. drwxr-xr-x2 0 0 80 Dec 17 13:25 doc2
4. -rw-r--r--1 0 0 1315 Dec 17 13:48 file1.txt
5. -rw-r--r--1 0 0 1499 Dec 17 13:48 file2.txt
6. lrwxrwxrwx1 0 0 9 Dec 17 13:49 link1 -> file1.txt
1.12 通用命令
ls --versionls –help
相关文章推荐
- linux 常用命令之ls的使用场景和结果解释
- linux 的 ls 命令的使用方法
- 详解Linux系统中ls和dir命令的组合使用
- Linux命令:ls命令使用方法
- 使用linux c 实现linux控制台 ls 命令
- Linux中的ls命令详细使用
- linux中如何使用ls命令查看s开头的文件?
- linux显示文件列表命令ls,使用ls --help列出所有命令参数
- linux之lsusb命令和cd -命令使用总结
- 10003---Linux中的ls命令详细使用
- 使用linux-c编程实现简单的ls命令
- Linux中的ls命令详细使用
- windows中使用linux ls命令
- Linux中的ls命令详细使用
- 【Linux】嵌入式开发,在Linux中使用C语言对Fork函数执行子函数及父函数,命令ps 及 ls 操作
- Linux中的ls命令详细使用
- linux中的一些基础命令的使用(which,whereis,locate,find,alias,file,ls,cat,echo,tar,bzip2,gzip,history,mv,cp,rm)
- Linux系统中ls命令的使用方法
- Linux中的ls命令详细使用
- linux文件操作之ls、mkdir、rmdir、cp命令使用