码迷,mamicode.com
首页 > 其他好文 > 详细

pushd和popd

时间:2015-06-23 17:11:46      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:

The pushd command saves the current working directory in memory so it can be returned to at any time, optionally changing to a new directory.

The popd command returns to the path at the top of the directory stack. This directory stack is accessed by the command dirs

pushd

pushd [path | ..]

Arguments:

  •  path This optional command-line argument specifies the directory to make the current directory. If path is omitted, the path at the top of the directory stack is used, which has the effect of toggling between two directories

popd

popd

Examples

[fedora@dhcp-129-232 ~]$ pushd Downloads/     # current directory ~ is saved, and ~/Downloads is added to directory stack

~/Downloads ~

[fedora@dhcp-129-232 Downloads]$ dirs     # check directory stack

~/Downloads ~

[fedora@dhcp-129-232 Downloads]$ pushd firefox   # ~/Downloads/firefox is added to directory stack

~/Downloads/firefox ~/Downloads ~

[fedora@dhcp-129-232 firefox]$ dirs     # check directory stack

~/Downloads/firefox ~/Downloads ~

[fedora@dhcp-129-232 firefox]$ popd     # go to the top directory "~/Downloads", the first is the top

~/Downloads ~

[fedora@dhcp-129-232 Downloads]$ pwd   

/home/fedora/Downloads





 

 

pushd和popd

标签:

原文地址:http://www.cnblogs.com/penny-jimmy/p/4595625.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!