macos 如何在 Mac OS X 的终端中反转 cd 命令?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9099600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:49:41  来源:igfitidea点击:

How do I reverse the cd command in the Terminal on Mac OS X?

macosterminal

提问by SamYoungNY

I am beginning to learn ruby and was following the instructions of one video to access the desktop through the -ls command in the terminal. Now, I would like to get out of the desktop in the terminal and don't know how. I know, I know I am a total noob... but can someone please help. Thanks. BTW the command I wrote was:

我开始学习 ruby​​ 并按照一个视频的说明通过终端中的 -ls 命令访问桌面。现在,我想退出终端中的桌面​​,但不知道如何。我知道,我知道我是个菜鸟……但是有人可以帮忙吗?谢谢。顺便说一句,我写的命令是:

   my-iMac~ me$ cd Desktop/
   my-iMac:Desktop samuel$ ls

回答by ughoavgfhw

Where would you like to go?

你想去哪里?

Go home: cdor cd ~
Go to the previous working directory: cd $OLDPWD
Go to parent of the current directory: cd ..
Go to any directory you want: cd /path/to/directory

Go home:cdcd ~
Go to the previous work directory: cd $OLDPWD
Go to parent of the current directory: cd ..
Go to any directory you want:cd /path/to/directory

回答by Scott Hunter

cd ..will take you back up 1 level.

cd ..将带您回到 1 个级别。