[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'