linux 中 ls -F选项

发布时间 2023-12-30 11:06:09作者: 小鲨鱼2018

 

linux 中 ls -F选项,F表示文件类型。

文件末尾追加*表示是可执行文件;

文件末尾/表示是目录

文件末尾是@表示是软链接文件

 

001、

[root@pc1 test]# ls              ##  测试目录
a.txt  b.txt  dir1  dir2  dir3  dir4  file1  file2  file3  file4
[root@pc1 test]# ls -l           ## 包含普通文件,目录,执行文件, 软链接,一共四类
total 4
-rwxrwxrwx. 1 root root 21 Dec 30 10:54 a.txt
lrwxrwxrwx. 1 root root  5 Dec 30 10:54 b.txt -> a.txt
drwxr-xr-x. 2 root root  6 Dec 30 10:39 dir1
drwxr-xr-x. 2 root root  6 Dec 30 10:39 dir2
drwxr-xr-x. 2 root root  6 Dec 30 10:39 dir3
drwxr-xr-x. 2 root root  6 Dec 30 10:39 dir4
-rw-r--r--. 1 root root  0 Dec 30 10:39 file1
-rw-r--r--. 1 root root  0 Dec 30 10:39 file2
-rw-r--r--. 1 root root  0 Dec 30 10:39 file3
-rw-r--r--. 1 root root  0 Dec 30 10:39 file4

 

002、ls -F列出文件类型

[root@pc1 test]# ls
a.txt  b.txt  dir1  dir2  dir3  dir4  file1  file2  file3  file4
[root@pc1 test]# ls -F     ## 末尾为*表示可执行文件; 末尾为@表示是软链接; 末尾为/表示是目录; 末尾什么也没有表示普通文件
a.txt*  b.txt@  dir1/  dir2/  dir3/  dir4/  file1  file2  file3  file4

 。