ls命令

ls命令

=========================================

[root@aminglinux ~]# which ls

alias ls='ls --color=auto'
/bin/ls

NAME

ls - list directory contents

SYNOPSIS

ls [OPTION]... [FILE]...

 

PARAMETER(常用的选项)


-a, --all 

do not ignore entries starting with . (不隐藏任何以. 开始的项目)示例:[root@aminglinux ~]# ls -a /root

. 1.txt .bash_history .bash_profile .cshrc .ssh .viminfo
.. anaconda-ks.cfg .bash_logout .bashrc dir10 .tcshrc

-d, --directory
list directories themselves, not their contents (列出目录本身,而不是它们的内容)
示例:
[root@aminglinux ~]# ls -d /root
/root

-h, --human-readable
with -l, print sizes in human readable format (e.g., 1K 234M 2G) (与-l,可读格式的打印尺寸(例如,1K 234M 2G))
示例:
[root@aminglinux ~]# ll -h /root/ (相当于ls -l -h /root)
总用量 8.0K
-rw-rwxr--+ 1 root root 52 6月 6 19:15 1.txt
-rw-------. 1 root root 1.4K 6月 5 21:51 anaconda-ks.cfg
drw-rw---- 2 root root 45 6月 7 11:20 dir10

-i, --inode
print the index number of each file (打印每个文件的索引号)
示例:
[root@aminglinux ~]# ls -i /root/
33574998 1.txt 33574988 anaconda-ks.cfg 3258 dir10 (蓝色的就是每个文件的索引号)
[root@aminglinux ~]# ll -i /root/
总用量 8
33574998 -rw-rwxr--+ 1 root root 52 6月 6 19:15 1.txt
33574988 -rw-------. 1 root root 1371 6月 5 21:51 anaconda-ks.cfg
3258 drw-rw---- 2 root root 45 6月 7 11:20 dir10
[root@aminglinux ~]# ls -a -i /root/
33574977 . 33929255 .bash_logout 50726121 .ssh
64 .. 33929256 .bash_profile 33929259 .tcshrc
33574998 1.txt 33929257 .bashrc 33587371 .viminfo
33574988 anaconda-ks.cfg 33929258 .cshrc
33587356 .bash_history 3258 dir10

-l
use a long listing format (使用长列表格式)
示例:
[root@aminglinux ~]# ll /root/ (相当于 ls -l /root/ )
总用量 8
-rw-rwxr--+ 1 root root 52 6月 6 19:15 1.txt
-rw-------. 1 root root 1371 6月 5 21:51 anaconda-ks.cfg
drw-rw---- 2 root root 45 6月 7 11:20 dir10


-t
sort by modification time, newest first (按修改时间排序,最新优先)
示例:
[root@aminglinux ~]# ll -t /root/
总用量 8
drw-rw---- 2 root root 45 6月 7 11:20 dir10
-rw-rwxr--+ 1 root root 52 6月 6 19:15 1.txt
-rw-------. 1 root root 1371 6月 5 21:51 anaconda-ks.cfg

posted @ 2018-06-10 21:36  SamboLee  阅读(196)  评论(0)    收藏  举报