linux命令---常见且冷门系列(2)ls 命令
目录
ls命令
ls -l 的另一面
ls 结果的排序
find 命令 递归搜索软链接文件夹
ls命令
必须要使用的命令,离不了。
ls -l 的另一面
我们一般会使用ls -l 命令,其实多数linux发型版本都内置了一个别名ll 命令,对就是两个小的的L。
因此我们直接敲ll就可以时间ls -l 的操作,是不是很简单高效啊,当然大家也可以自己自定义别名。
如下代码段:
root@kali:~/test# ls -l
总用量 8
drwxr-xr-x 3 root root 4096 6月 4 10:18 a
drwxr-xr-x 3 root root 4096 6月 4 10:19 b
lrwxrwxrwx 1 root root 11 6月 4 10:29 linkDir -> /root/test1
-rw-r--r-- 1 root root 0 6月 4 10:19 root.txtroot@kali:~/test# ll
总用量 8
drwxr-xr-x 3 root root 4096 6月 4 10:18 a
drwxr-xr-x 3 root root 4096 6月 4 10:19 b
lrwxrwxrwx 1 root root 11 6月 4 10:29 linkDir -> /root/test1
-rw-r--r-- 1 root root 0 6月 4 10:19 root.txtroot@kali:~/test# alias
diff='diff --color=auto'
egrep='egrep --color=auto'
fgrep='fgrep --color=auto'
grep='grep --color=auto'
history='history 0'
ip='ip --color=auto'
l='ls -CF'
la='ls -A'
ll='ls -l'
ls='ls --color=auto'
which-command=whenceroot@kali:~/test#
ls 结果的排序
ls 默认是有排序的,默认是文件名排序。如下例子
root@kali:~/test# ll --full-time
总用量 20
-rw-r--r-- 1 root root 15 2022-06-04 14:03:16.163601113 +0800 a1.txt
-rw-r--r-- 1 root root 10 2022-06-04 14:03:05.859904505 +0800 a.txt
-rw-r--r-- 1 root root 19 2022-06-04 14:03:24.995341154 +0800 b.txt
-rw-r--r-- 1 root root 4 2022-06-04 14:03:34.131072338 +0800 c.txt
-rw-r--r-- 1 root root 10 2022-06-04 14:03:41.090867621 +0800 d.txtroot@kali:~/test#
根据名字反向排序 -r
root@kali:~/test# ll --full-time -r
总用量 20
-rw-r--r-- 1 root root 10 2022-06-04 14:03:41.090867621 +0800 d.txt
-rw-r--r-- 1 root root 4 2022-06-04 14:03:34.131072338 +0800 c.txt
-rw-r--r-- 1 root root 19 2022-06-04 14:03:24.995341154 +0800 b.txt
-rw-r--r-- 1 root root 10 2022-06-04 14:03:05.859904505 +0800 a.txt
-rw-r--r-- 1 root root 15 2022-06-04 14:03:16.163601113 +0800 a1.txtroot@kali:~/test#
根据修改时间、根据文件大小排序 例子如下:
# 按照大小排序 也支持-r
root@kali:~/test# ll --full-time -S
总用量 20
-rw-r--r-- 1 root root 19 2022-06-04 14:03:24.995341154 +0800 b.txt
-rw-r--r-- 1 root root 15 2022-06-04 14:03:16.163601113 +0800 a1.txt
-rw-r--r-- 1 root root 10 2022-06-04 14:03:05.859904505 +0800 a.txt
-rw-r--r-- 1 root root 10 2022-06-04 14:03:41.090867621 +0800 d.txt
-rw-r--r-- 1 root root 4 2022-06-04 14:03:34.131072338 +0800 c.txtroot@kali:~/test#
#根据修改时间排序 也支持-r
root@kali:~/test# ll --full-time -t
总用量 20
-rw-r--r-- 1 root root 10 2022-06-04 14:03:41.090867621 +0800 d.txt
-rw-r--r-- 1 root root 4 2022-06-04 14:03:34.131072338 +0800 c.txt
-rw-r--r-- 1 root root 19 2022-06-04 14:03:24.995341154 +0800 b.txt
-rw-r--r-- 1 root root 15 2022-06-04 14:03:16.163601113 +0800 a1.txt
-rw-r--r-- 1 root root 10 2022-06-04 14:03:05.859904505 +0800 a.txt
find 命令 递归搜索软链接文件夹
默认情况下find命令不会递归进入软链接的文件夹来搜索文件的,详见
CSDN
https://mp.csdn.net/mp_blog/creation/editor/125119223
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
