首页 > 其他 > 详细

pushd和popd

时间:2015-06-23 17:08:36      阅读:225      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!