码迷,mamicode.com
首页 > 其他好文 > 详细

ls 命令

时间:2016-02-03 15:26:49      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:

目录处理命令:ls

命令名称: 

 ls

命令英文原意:

list

命令所在路径:

/bin/ls

执行权限:

所有用户

功能描述:

显示目录文件

语法:

ls 选项[-ald][文件或目录]

 

-a  显示所有文件,包括隐藏文件

 

-l  详细信息显示

 

-d  查看目录属性

#ls -a 查看本目录下的文件(包含隐藏文件)

#ls -l 显示文件的详细信息

 

1 root root  1208 12月  3 06:22 anaconda-ks.cfg

 

1 root root 24772 12月  3 06:22 install.log

 

1 root root  7690 12月  3 06:21 install.log.syslog

 

root 所有者  root 所属组  7690  文件大小

 

下面的ls -lh是将文件大小的字节显示转变成我们所熟悉的Windows

 

1
2
3
4
5
[root@localhost ~]# ls -lh
总用量 44K
-rw-------. 1 root root <span style="font-size: 16px;"><strong><span style="color: #800080;">1.2K</span></strong></span> 12月  3 06:22 anaconda-ks.cfg
-rw-r--r--. 1 root root  25K 12月  3 06:22 install.log
-rw-r--r--. 1 root root 7.6K 12月  3 06:21 install.log.syslog

 

1.2K 和 7690代表的是一个意思,只不过当用ls -lh的时候会将文件大小变成我们所熟悉的K、M、G表示而不是字节表示。

-rw-r--r--

-文件类型(-二进制文件   d表示目录   l表示软链接文件)

 

rw-   r--   r--

 

u     g      o

 

u所有者 g所属组 o其他人

PS: r读 w写 x执行

 

1
2
[root@localhost ~]# ls -lhd /etc
drwxr-xr-x. 102 root root 12K 12月 15 06:36 /etc

 

ls -lhd /etc 是查看etc目录的大小而不是查看ect目录下的所有内容。

 

1
2
[root@localhost ~]# ls -i
795111 anaconda-ks.cfg  786436 install.log  786437 install.log.syslog

 

#ls -i 查看每个文件的id号

ls 命令

标签:

原文地址:http://www.cnblogs.com/siashan/p/5179639.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!