Skip to content

Instantly share code, notes, and snippets.

@ghostcode
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save ghostcode/9ccd528c882c1abdb4b9 to your computer and use it in GitHub Desktop.

Select an option

Save ghostcode/9ccd528c882c1abdb4b9 to your computer and use it in GitHub Desktop.
切换目录

一些特殊的目录:

  • . 表示此层目录
  • .. 表示上一层目录
    • 表示前一个目录
  • ~ 表示“当前用户身份”所在的家目录
  • ~account 表示account用户的家目录

注:根目录(/)也有. 和 ..,其实它俩是同一个目录

常见处理目录命令:

cd (切换目录)

cd [相对路径或绝对路径]
cd ~xiezi

表示回到xiezi用户的家目录,即 /home/xiezi

cd ~

表示回到自己的家目录,即 /root目录

cd 

没有加任何路径,也表示回到自己的家目录。

cd -

表示回到刚才的目录。

cd /var/workspace

表示绝对路径写法。

cd ../demo

相对路径写法,我们由 /var/workspace 到 /var/demo。注意var目录下得存在demo目录才行,不然得走绝对路径。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment