[root@localhost /]# node
首先解釋下這塊, root表明當前登陸用戶,localhost表明主機名, ~表明當前主機目錄,#表明用戶權限 #表示超級用戶,$表示普通用戶;bash
查詢目錄中內容命令 ls (list縮寫)
ide
格式 ls [選項] [文件或目錄]spa
選項:orm
ls -a 顯示全部文件,包括隱藏文件crontab
ls -l 顯示詳細信息it
ls -d 查看目錄屬性console
ls -h 人性化顯示文件大小class
ls -i 顯示inode登錄
超級用戶root默認的當前目錄是 root目錄
咱們能夠用pwd命名(Print Working Directory 打印當前工做目錄)看到 /root
咱們打印下當前目錄下文件信息:
[root@localhost ~]# ls
anaconda-ks.cfg
只有一個文件
假如咱們要列出全部文件 用 ls -a 把隱藏文件也顯示出來
[root@localhost ~]# ls -a
. anaconda-ks.cfg .bash_logout .bashrc .tcshrc
.. .bash_history .bash_profile .cshrc
多了一些文件
咱們也能夠看其餘目錄的文件:
[root@localhost ~]# ls /etc/
adjtime modprobe.d
aliases modules-load.d
aliases.db motd
alternatives mtab
anacrontab my.cnf
asound.conf my.cnf.d
audisp NetworkManager
audit networks
一樣也能夠看具體某個文件
[root@localhost ~]# ls -l /etc/vconsole.conf
-rw-r--r--. 1 root root 37 6月 10 05:23 /etc/vconsole.conf
咱們用 -l 或者 -la 組合 列出詳細信息;
[root@localhost ~]# ls -l
總用量 4
-rw-------. 1 root root 1237 6月 10 05:24 anaconda-ks.cfg
[root@localhost ~]# ls -la
總用量 24
dr-xr-x---. 2 root root 135 6月 11 21:13 .
dr-xr-xr-x. 17 root root 224 6月 10 05:23 ..
-rw-------. 1 root root 1237 6月 10 05:24 anaconda-ks.cfg
-rw-------. 1 root root 0 6月 11 21:13 .bash_history
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
[root@localhost ~]#
這裏第一列 好比 dr-xr-xr-x. 表明文件類型以及全部者,所屬組以及其餘者權限
第一位d表明文件類型 常見的有 - 表明 文件 d表示目錄 | 軟件連接文件
dr-xr-xr-x( d(第一位表示目錄) r-x(第一個三位 全部者 具備讀和執行的權限) r-x(第二個三位) r-x(第三個三位) )
後面9位 每3位一個組 分別是 全部者u 所屬組g 以及 其餘者o的權限
權限分三種 r讀 w寫 x執行
好比 dr-xr-xr-x 這個目錄 全部者 所屬組 以及其餘者 都有 讀和執行權限;
好比 -rw------- 這個文件 全部者有讀寫權限 所屬組以及其餘者沒有權限;
第二列 那個數字 是 硬連接次數 後面再說;
第三列 root 是 全部者;
第四列 root 是 所屬組;
第五列 是文件大小;假如看不慣 可用 ls -lh
[root@localhost ~]# ls -lh
總用量 4.0K
-rw-------. 1 root root 1.3K 6月 10 05:24 anaconda-ks.cfg
第六列的日期是該文件最後一次修改時間;
最後一列 是文件名稱;
查看目錄屬性 要加 -d
[root@localhost ~]# ls -ld /etc/
drwxr-xr-x. 78 root root 8192 6月 13 15:50 /etc/
[root@localhost ~]#
查看文件的inode屬性 相似 主鍵 惟一識別文件的Id 用 -i
[root@localhost ~]# ls -li
總用量 4
33574979 -rw-------. 1 root root 1237 6月 10 05:24 anaconda-ks.cfg
[root@localhost ~]#
33574979 就是inode屬性