基礎命令 ls
作用:
用于查看檔案或目錄資訊
常用引數
-l 長格式顯示資訊
-a 顯示所有檔案(隱藏檔案)
-h 以KB顯示位元組
-d 顯示目錄資訊
-i 查看i節點號
案例1 長格式顯示資訊 (-l)
[root@localhost ~]# ls -l
總用量 0
-rw-r--r--. 1 root root 0 12月 2 05:29 1.txt
#資訊說明
-rw-r--r--. #權限
root root #所有者
12月 2 05:29 #創建月份、時間
1.txt #檔案名稱
案例2 顯示所有檔案(-a)
[root@localhost ~]# ls -a
. .abc.swp .bash_profile .cshrc .viminfo
.. .bash_history .bashrc .tcshrc .Xauthority
1.txt .bash_logout .bashrc.swp .test
#"."點開頭的檔案,表示隱藏檔案,
案例3 顯示檔案大小(-h)
[root@localhost ~]# ls -lh
總用量 0
-rw-r--r--. 1 root root 0 12月 2 05:29 1.txt
#查看檔案大小時,需要搭配-l 以長格式顯示
案例4 顯示目錄(-d)
[root@localhost ~]# ls -d /bin/
/bin/
#-d 的作用是把目錄像檔案一樣顯示出來
案例5 查看節點號(-i)
[root@localhost ~]# ls -i
130563 1.txt 130872 test
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/237570.html
標籤:其他
