cd 目录 切换工作目录
[root@localhost ~]# cd /tmp
[root@localhost tmp]#
由此可见 用cd 从家目录切换到tmp目录下
cd - 切换到上次所在的目录
[root@localhost tmp]# cd /home
[root@localhost home]# cd -
/tmp
[root@localhost tmp]#
cd .. 切换到上级目录
[root@localhost home]# ls
wah
[root@localhost home]# cd wah
[root@localhost wah]# cd ..
[root@localhost home]#
cd ~ 切换到当前用户的家目录下
[root@localhost home]# cd ~
[root@localhost ~]# pwd
/root
[root@localhost ~]#
cd ../.. 切换到上两级目录
[root@localhost /]# ls
bin dev home lib64 mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr
[root@localhost /]# cd /home
[root@localhost home]# ls
wah
[root@localhost home]# cd wah
[root@localhost wah]# cd ../..
[root@localhost /]#
ls 查看目录下的内容
[root@localhost home]# ls
wah
[root@localhost home]#
查看/home下的内容
-l 显示文件或者目录的详细信息 ls -l 等价于 ll
[root@localhost home]# ll
总用量 0
drwx------. 14 wah wah 271 3月 22 00:02 wah
[root@localhost home]#
-a 显示所有文件,包括以“.”开头的隐藏文件。
[root@localhost home]# ls -a
. .. wah
[root@localhost home]#
-ld 如果参数是目录,以得到目录的详细信息。
[root@localhost home]# ls -ld
drwxr-xr-x. 3 root root 17 3月 22 00:02 .
[root@localhost home]#