[root@linux-128 ~]# ls / bin dev home lib64 mnt proc run srv tmp var boot etc lib media opt root sbin sys usr
[root@linux-128 ~]# yum install -y tree //這裏我已經安裝了。 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.cn99.com * updates: mirrors.cn99.com 軟件包 tree-1.6.0-10.el7.x86_64 已安裝而且是最新版本
tree –L 2 / 指定目錄的最大深度爲2
[root@linux-128 ~]# tree -L 2 /boot /boot ├── config-3.10.0-514.el7.x86_64 ├── grub │ └── splash.xpm.gz ├── grub2 │ ├── device.map │ ├── fonts │ ├── grub.cfg │ ├── grubenv │ ├── i386-pc │ ├── locale │ └── themes ├── initramfs-0-rescue-eeb900e7bf10452a92774afda44a57b2.img ├── initramfs-3.10.0-514.el7.x86_64.img ├── initramfs-3.10.0-514.el7.x86_64kdump.img ├── initrd-plymouth.img ├── symvers-3.10.0-514.el7.x86_64.gz ├── System.map-3.10.0-514.el7.x86_64
/bin/ /sbin/ 存放都是咱們日常用的命令,如ls,tree,man等,爲何這些命令能夠直接使用,是由於咱們有一個環境變量PATH。/sbin/目錄下面通常是root用戶使用的,普通用戶沒有權限使用,普通用戶用/bin/下面的,root用戶也可使用。node
/root/ :root的家目錄,存放一些用戶的配置文件和東西,好比/root/.ssh/authorized_keys,若是一個普通用戶要存放公鑰,它必須在普通用戶的家目錄下建立一個.ssh/authorized_keys,命令:linux
[root@linux-128 ~]# useradd wuzhou [root@linux-128 ~]# ls /home/wuzhou/ [root@linux-128 ~]# mkdir /home/wuzhou/.ssh/authorized_keys
/boot/ :存放系統啓動相關的文件,好比grub,grub2.裏面都是系統啓動相關文件,不能刪除。windows
/dev/ :是linux特有的設備文件,好比光驅,硬盤,鼠標等。緩存
/etc/ : 存放系統配置文件的目錄bash
這裏是列表文本這裏是列表文本/home/ : 用戶的家目錄。oracle
/lib/ /lib64/ : 存放系統庫文件的目錄,不少命令都是依賴庫文件,好比ls久以來一些庫文件,有點像windows裏面的.dll文件。ssh
使用ldd 能夠查看一個命令依賴那些庫,這裏命令要寫絕對路徑。socket
[root@linux-128 ~]# ldd /bin/ls linux-vdso.so.1 => (0x00007ffd7c382000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fd64daea000) libcap.so.2 => /lib64/libcap.so.2 (0x00007fd64d8e5000) libacl.so.1 => /lib64/libacl.so.1 (0x00007fd64d6db000) libc.so.6 => /lib64/libc.so.6 (0x00007fd64d31a000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fd64d0b9000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fd64ceb4000) /lib64/ld-linux-x86-64.so.2 (0x00007fd64dd19000) libattr.so.1 => /lib64/libattr.so.1 (0x00007fd64ccaf000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd64ca93000)
/media/ :媒介目錄,默認爲空,插入U盤會自動存放在media目錄下。插件
/mnt/ : 臨時掛載目錄,默認爲空,能夠將光驅和硬盤臨時掛在/mnt/下用。日誌
/opt/ : 默認爲空,會把oracle安裝再這個目錄下。
/proc/ : 存放系統啓動的一些進程,它會生成一個pid文件;若是工做中發現某個進程不太熟悉,咱們能夠找到這個進程的pid,經過pid去查看進程具體在哪裏運行的,命令:
[root@linux-128 ~]# ls -l /proc/8 ls: 沒法讀取符號連接/proc/8/exe: 沒有那個文件或目錄 總用量 0 dr-xr-xr-x 2 root root 0 10月 20 15:00 attr -rw-r--r-- 1 root root 0 10月 20 15:00 autogroup -r-------- 1 root root 0 10月 20 15:00 auxv -r--r--r-- 1 root root 0 10月 20 15:00 cgroup --w------- 1 root root 0 10月 20 15:00 clear_refs -r--r--r-- 1 root root 0 10月 20 14:46 cmdline -rw-r--r-- 1 root root 0 10月 20 15:00 comm -rw-r--r-- 1 root root 0 10月 20 15:00 coredump_filter -r--r--r-- 1 root root 0 10月 20 15:00 cpuset lrwxrwxrwx 1 root root 0 10月 20 15:00 cwd -> / \\這裏cwd -> / 就是進程所在的路徑 -r-------- 1 root root 0 10月 20 15:00 environ
/run/ :進程產生的臨時文件,因此一重啓就會消失。
/src/ :默認爲空,服務產生的一些文件。
/sys/ :存放系統內核相關的文件。
/tmp/ :系統的臨時文件的目錄,權限很大,任何一個用戶都能操做,可是它有一個特殊權限,用戶只能操做用戶本身的文件和目錄。
/usr/ :存放用戶的一些文件。
/var/ :存放系統產生的一些系統日誌,系統進程,服務,一些臨時文件,pid,log,緩存等。/var/log/messages:系統的總日誌文件。另外,mail指令的預設也設置在這裏。
[root@linux-128 ~]# ls -l / 總用量 16 lrwxrwxrwx. 1 root root 7 10月 17 03:41 bin -> usr/bin dr-xr-xr-x. 4 root root 4096 10月 17 03:54 boot drwxr-xr-x 19 root root 3200 10月 20 14:46 dev drwxr-xr-x. 77 root root 8192 10月 20 15:14 etc drwxr-xr-x. 3 root root 20 10月 20 15:14 home lrwxrwxrwx. 1 root root 7 10月 17 03:41 lib -> usr/lib
[root@linux-128 ~]# ls -i 16797771 anaconda-ks.cfg \\ 16797771 就是文件anaconda-ks.cfg的inode號
[root@linux-128 ~]# ls –a . anaconda-ks.cfg .bash_logout .bashrc .ssh .. .bash_history .bash_profile .cshrc .tcshrc
[root@linux-128 ~]# ls -tl / 總用量 16 //最新排在最上面,最舊排在最下面。 drwxrwxrwt. 8 root root 233 10月 20 15:39 tmp drwxr-xr-x. 3 root root 20 10月 20 15:14 home drwxr-xr-x. 77 root root 8192 10月 20 15:14 etc drwxr-xr-x 21 root root 580 10月 20 15:03 run drwxr-xr-x 19 root root 3200 10月 20 14:46 dev drwxr-xr-x. 19 root root 267 10月 20 14:46 var dr-xr-xr-x 13 root root 0 10月 20 14:46 sys dr-xr-xr-x 119 root root 0 10月 20 14:46 proc dr-xr-x---. 3 root root 147 10月 18 19:15 root
[root@linux-128 ~]# ls -ld /root/ dr-xr-x---. 3 root root 147 10月 18 19:15 /root/
[root@linux-128 ~]# ls -lh / 總用量 16K lrwxrwxrwx. 1 root root 7 10月 17 03:41 bin -> usr/bin dr-xr-xr-x. 4 root root 4.0K 10月 17 03:54 boot drwxr-xr-x 19 root root 3.2K 10月 20 14:46 dev drwxr-xr-x. 77 root root 8.0K 10月 20 15:14 etc drwxr-xr-x. 3 root root 20 10月 20 15:14 home lrwxrwxrwx. 1 root root 7 10月 17 03:41 lib -> usr/lib lrwxrwxrwx. 1 root root 9 10月 17 03:41 lib64 -> usr/lib64
[root@linux-128 ~]# ls -l /etc -rw-r--r--. 1 root root 16 10月 17 03:50 adjtime -rw-r--r--. 1 root root 1518 6月 7 2013 aliases -rw-r--r--. 1 root root 12288 10月 17 03:53 aliases.db drwxr-xr-x. 2 root root 236 10月 17 03:44 alternatives
咱們在用ls 查看文件屬性的時候,共顯示了9列信息。
第一列:表示文件類型
第二列爲有多個文件佔用的inode是相同的,若是是目錄,那這個數值與該目錄底下有多少個一級子目錄。
[root@linux-128 ~]# ls -ld /root dr-xr-x---. 3 root root 147 10月 18 19:15 /root
這裏第二列值會3,咱們看下/root/下面有幾個子目錄:
[root@linux-128 ~]# ls -la /root dr-xr-x---. 3 root root 147 10月 18 19:15 . //當前目錄 dr-xr-xr-x. 17 root root 265 10月 19 15:07 .. //上一級目錄 -rw-------. 1 root root 1422 10月 17 03:51 anaconda-ks.cfg -rw-------. 1 root root 989 10月 19 23:30 .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 drwx------. 2 root root 80 10月 19 17:04 .ssh //這個是咱們放公鑰的目錄 -rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
第三列表示該文件的全部者
第四列表示該文件的所屬組
第五列表示該文件的大小
第6、7、八列表示時間
第九列表示文件名
[root@linux-128 ~]# which ls alias ls='ls --color=auto' /usr/bin/ls //絕對路徑
[root@linux-128 ~]# alias aming='ls -lha' [root@linux-128 ~]# aming 總用量 28K dr-xr-x---. 3 root root 147 10月 18 19:15 . dr-xr-xr-x. 17 root root 265 10月 19 15:07 .. -rw-------. 1 root root 1.4K 10月 17 03:51 anaconda-ks.cfg -rw-------. 1 root root 989 10月 19 23:30 .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 drwx------. 2 root root 80 10月 19 17:04 .ssh -rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
[root@linux-128 ~]# unalias aming [root@linux-128 ~]# aming -bash: aming: 未找到命令
[root@linux-128 ~]# alias alias cp='cp -i' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l.='ls -d .* --color=auto' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias mv='mv -i' alias rm='rm -i' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'