Lệnh ls được sử dụng khá phổ biến với tần suất sử dụng nhiều.
1. Liệt kê file sử dụng lệnh ls không tùy chọn
[root@zimbra2 ~]# ls
anaconda-ks.cfg Desktop Documents Downloads install.log install.log.syslog Music Pictures Public Templates Videos
[root@zimbra2 ~]#
2. Liệt kê file hoặc thư mục cùng tùy chọn -l
Tất cả các file được hiển thị sẽ có quyền của tập tin, chủ tập tin, ngày tháng ...
root@zimbra2 ~]# ls -l
total 192
-rw-------. 1 root root 9129 Aug 16 2014 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Aug 16 2014 Desktop
drwxr-xr-x. 2 root root 4096 Aug 16 2014 Documents
drwxr-xr-x. 2 root root 4096 Aug 16 2014 Downloads
-rw-r--r--. 1 root root 114660 Aug 16 2014 install.log
-rw-r--r--. 1 root root 25605 Aug 16 2014 install.log.syslog
drwxr-xr-x. 2 root root 4096 Aug 16 2014 Music
drwxr-xr-x. 2 root root 4096 Aug 16 2014 Pictures
drwxr-xr-x. 2 root root 4096 Aug 16 2014 Public
drwxr-xr-x. 2 root root 4096 Aug 16 2014 Templates
drwxr-xr-x. 2 root root 4096 Aug 16 2014 Videos
[root@zimbra2 ~]#
3. Xem tập tin ẩn với tùy chọn -a
[root@zimbra2 ~]# ls -a
. .bash_logout .cshrc .esd_auth .gnote .ICEauthority Music .pulse .ssh .Xauthority
.. .bash_profile .dbus .gconf .gnupg .imsettings.log .mysql_history .pulse-cookie .targetcli .xauthqQW5Cx
.abrt .bashrc Desktop .gconfd .gstreamer-0.10 install.log .nautilus .redhat .tcshrc .xsession-errors
anaconda-ks.cfg .cache Documents .gnome2 .gtk-bookmarks install.log.syslog Pictures .rnd Templates .xsession-errors.old
.bash_history .config Downloads .gnome2_private .gvfs .local Public .spamassassin Videos
[root@zimbra2 ~]#
4. Liệt kê file và kích thước với tùy chọn -lh
[root@zimbra2 ~]# ls -lh
total 192K
-rw-------. 1 root root 9.0K Aug 16 2014 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 Desktop
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 Documents
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 Downloads
-rw-r--r--. 1 root root 112K Aug 16 2014 install.log
-rw-r--r--. 1 root root 26K Aug 16 2014 install.log.syslog
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 Music
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 Pictures
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 Public
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 Templates
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 Videos
[root@zimbra2 ~]#
Không có nhận xét nào:
Đăng nhận xét