Linux文件和目录的操作(三) ls

1、查看目录及文件:ls list

ls的命令选项

选项

含义

-a

列出所有文件,包括隐藏文件

-l

以详细格式列出

-d

列出目录信息

-F

列出文件类型

-h

以可读方式显示文件大小

-i

列出i-node节点索引号码

-n

uidgid表示用户名和密码

-r

倒序列出

-R

递归列出

-t

按修改时间排列

[user1@localhost ~]$ ls -a

.  ..  .bash_logout  .bash_profile  .bashrc  .emacs  file1  file2  file3  folder1  folder2  folder3  folder4  .lesshst  .mozilla  .viminfo

[user1@localhost ~]$ ls -l

total 16

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:10 file1

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file2

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file3

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder1

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder2

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder3

drwxrwxr-x 3 user1 user1 4096 Feb  1 22:33 folder4

[user1@localhost ~]$ ls -d

.

[user1@localhost ~]$ ls -dl

drwx------ 7 user1 user1 4096 Feb  1 22:33 .

[user1@localhost ~]$ ls -Fl

total 16

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:10 file1

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file2

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file3

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder1/

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder2/

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder3/

drwxrwxr-x 3 user1 user1 4096 Feb  1 22:33 folder4/

[user1@localhost ~]$ ls -hl

total 16K

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:10 file1

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file2

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file3

drwxrwxr-x 2 user1 user1 4.0K Feb  1 22:32 folder1

drwxrwxr-x 2 user1 user1 4.0K Feb  1 22:32 folder2

drwxrwxr-x 2 user1 user1 4.0K Feb  1 22:32 folder3

drwxrwxr-x 3 user1 user1 4.0K Feb  1 22:33 folder4

[user1@localhost ~]$ ls -il

total 16

393255 -rw-rw-r-- 1 user1 user1    0 Feb  1 22:10 file1

393260 -rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file2

393261 -rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file3

393256 drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder1

393258 drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder2

393259 drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder3

393262 drwxrwxr-x 3 user1 user1 4096 Feb  1 22:33 folder4

[user1@localhost ~]$ ls -nl

total 16

-rw-rw-r-- 1 505 505    0 Feb  1 22:10 file1

-rw-rw-r-- 1 505 505    0 Feb  1 22:26 file2

-rw-rw-r-- 1 505 505    0 Feb  1 22:26 file3

drwxrwxr-x 2 505 505 4096 Feb  1 22:32 folder1

drwxrwxr-x 2 505 505 4096 Feb  1 22:32 folder2

drwxrwxr-x 2 505 505 4096 Feb  1 22:32 folder3

drwxrwxr-x 3 505 505 4096 Feb  1 22:33 folder4

[user1@localhost ~]$ ls -rl

total 16

drwxrwxr-x 3 user1 user1 4096 Feb  1 22:33 folder4

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder3

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder2

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder1

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file3

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file2

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:10 file1

[user1@localhost ~]$ ls -Rl

.:

total 16

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:10 file1

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file2

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file3

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder1

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder2

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder3

drwxrwxr-x 3 user1 user1 4096 Feb  1 22:33 folder4

 

./folder1:

total 0

 

./folder2:

total 0

 

./folder3:

total 0

 

./folder4:

total 4

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:33 folder41

 

./folder4/folder41:

total 0

[user1@localhost ~]$ ls -tl

total 16

drwxrwxr-x 3 user1 user1 4096 Feb  1 22:33 folder4

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder1

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder2

drwxrwxr-x 2 user1 user1 4096 Feb  1 22:32 folder3

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file2

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:26 file3

-rw-rw-r-- 1 user1 user1    0 Feb  1 22:10 file1

你可能感兴趣的:(linux,ls)