共计 937 个字符,预计需要花费 3 分钟才能阅读完成。
提醒:本文最后更新于2019-07-17 19:36,文中所关联的信息可能已发生改变,请知悉!
[v_act]格式:cd [dir]
~USERNAME:切换至指定用户的家目录;如不指定用户为直接切换到当前用户的家目录
-:返回进入当前目录之前所在的目录,功能为在上一个目录和当前目录之间来回切换。
..:返回上级目录(若当前目录为“/“,则执行完后还在“/”;”..”为上级目录的意思)[/v_act]
[root@localhost ~]# cd /tmp/
[root@localhost tmp]# pwd
/tmp
[root@localhost tmp]#
不加任何路径为直接切换到当前用户的家目录;等同于命令(cd ~)
[root@localhost tmp]# pwd
/tmp
[root@localhost tmp]# cd
[root@localhost ~]# pwd
/root
[root@localhost ~]#
~USERNAME:切换至指定用户的家目录;如不指定用户为直接切换到当前用户的家目录
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd ~user1
[root@localhost user1]# pwd
/home/user1
[root@localhost user1]# cd ~
[root@localhost ~]# pwd
/root
[root@localhost ~]#
cd -:返回进入此目录之前所在的目录,功能为在上一个目录和当前目录之间来回切换。
[root@localhost user1]# pwd
/home/user1
[root@localhost user1]# cd -
/root
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd -
/home/user1
[root@localhost user1]# pwd
/home/user1
[root@localhost user1]#
cd ..:返回上级目录(若当前目录为“/“,则执行完后还在“/”;”..”为上级目录的意思)
[root@localhost user1]# pwd
/home/user1
[root@localhost user1]# cd ..
[root@localhost home]# pwd
/home
[root@localhost home]#
正文完