
格式:ls [OPTION]… [DIR]…& D& q7 F b, b6 e
不加任何选项和路径为直接显示当前位置的文件列表
% j9 s" H& I5 I5 b" l4 m$ y- [root@localhost # ls
- anaconda-ks.cfg
- [root@localhost # pwd
- /root
- [root@localhost # ls /root/
- anaconda-ks.cfg
- [root@localhost # . k( g/ B* j+ N3 y* N6 X0 u
9 q. j! S# Q$ X" A-a,–all:显示所有文件,包括隐藏文件。
' k t9 H* N- x9 z* M- [root@localhost # ls -a
- . anaconda-ks.cfg .bash_logout .bashrc .tcshrc
- .. .bash_history .bash_profile .cshrc .viminfo
- [root@localhost # ls --all
- . anaconda-ks.cfg .bash_logout .bashrc .tcshrc
- .. .bash_history .bash_profile .cshrc .viminfo
- [root@localhost #+ {. S6 @' m, g4 s5 w: x
0 O. m% c2 I& H! T: y+ w, m' p-l:长格式模式显示文件的相关信息
" Q" L! b* w0 A( ^% r3 W- [root@localhost # ls -l
- total 4
- -rw-------. 1 root root 1301 Jun 22 00:53 anaconda-ks.cfg
- [root@localhost #
9 K' V8 b% o9 Z4 u" H 系统默认有个别名命令为(ll=ls -l);简化命令的输入,按需使用。% d ^2 G- _ s4 Z+ `
- [root@localhost # ll
- total 4
- -rw-------. 1 root root 1301 Jun 22 00:53 anaconda-ks.cfg
- [root@localhost # ls -l
- total 4
- -rw-------. 1 root root 1301 Jun 22 00:53 anaconda-ks.cfg
- [root@localhost #
' {, b; B! R% }# E; h. R# M # w. Q8 U) f, ?
; [* U, n8 O& b" t1 W8 M( o
+ c. C/ ^) m6 B-h:单位换算,优化容量显示模式(和参数-l配套使用);当长格式显示文件信息时,文件的大小默认单位是字节,不便于查看,此参数把字节转换显示为KB。
8 s' [; Y9 d0 Z, c+ `- [root@localhost # ls -lh
- total 4.0K
- -rw-------. 1 root root 1.3K Jun 22 00:53 anaconda-ks.cfg
- [root@localhost # 4 T5 y/ N9 L: S8 j) F2 @- C0 ^
+ _9 |$ c( t: S T
-d:显示目录自身的相关信息(和参数-l配套使用)
6 c- t( Z' u" b4 c) Y0 Y- [root@localhost # ls -l /root/
- total 4
- -rw-------. 1 root root 1301 Jun 22 00:53 anaconda-ks.cfg
- [root@localhost # ls -ld /root/
- dr-xr-x---. 2 root root 4096 Jun 23 17:11 /root/
- [root@localhost #
8 ?* N' N- J/ y6 Q2 [ 4 r* y0 B* j/ T$ c7 n$ }
3 l4 r Y# ~/ K5 U. {# D
|
|