The pushd tag has no usage guidance.
61
votes
4answers
57k views
How do I use pushd and popd commands?
What are the practical uses of both pushd and popd when there is an advantage of using these two commands over cd and cd -?
EDIT: I'm looking for some practical examples of uses for both of these ...
2
votes
1answer
55 views
How can I popd to a specific directory?
I have used pushd to move about to various directories and now If I run
dirs -v
I get:
0 ~/Desktop
1 /etc
2 /var/log
3 ~/Downloads
4 /tmp
How can I popd to a specific directory in the ...
20
votes
6answers
2k views
Do we have more history for cd?
cd - can move to the last visited directory. Can we visit more history other than the last one?
1
vote
1answer
424 views
-ksh: pushd: not found
I am new to Unix and I am trying to used pushd, popd and dirs in SUSE Linux but I am getting
-ksh: pushd: not found
while I try to check pushd
which pushd
which: no pushd in ...
0
votes
1answer
107 views
Does pushd always push the current directory?
$ pwd
/tmp/d1
$ dirs
/tmp/d1
$ pushd ../d2
/tmp/d2 /tmp/d1
$ popd
/tmp/d1
$ pwd
/tmp/d1
It seems that pushd always pushes the current directory e.g. /tmp/d1 into the stack, although I run it as ...
17
votes
1answer
2k views
removing or clearing stack of popd/pushd paths
After pushding too many times, I want to clear the whole stack of paths.
How would I popd all the items in the stack?
I'd like to popd without needing to know how many are in the stack?
The bash ...
3
votes
1answer
115 views
Persistent directory stacks across sessions in zsh
I would like to share my directory stack (the one accessed with dirs) across sessions and tmux panes/windows.
In the zshbuiltins man page I have found autopushd to add every directory I switch into ...
0
votes
1answer
109 views
Using pushd and popd [duplicate]
Say I do the following:
cd ~
pushd .
cd /bin/
pushd .
dirs
"/bin/ ~/
cd ~/Downloads/
pushd .
dirs
~/Downloads /bin/ ~"
How would I popd back to something a while ago, say from downloads to the home ...
2
votes
1answer
115 views
bash - inherit directory stack in children
If, in my newly created bash, I do:
pushd foo
pushd bar
dirs -l -v
I will get something like
0 bar
1 foo
2 old_dir
If I then do
bash
dirs -l -v
I get only
0 bar
The same thing happens ...
3
votes
2answers
391 views
Refer to an item in `dirs`
I use pushd to work with multiple directories in bash and zsh. I've aliased dirs to dirs -v so that I get an ordered list when I want to see what's on the directory stack:
chb$ dirs
0 ...
5
votes
2answers
984 views
Conflict between `pushd .` and `cd -`
I am a happy user of the cd - command to go to the previous directory. At the same time I like pushd . and popd.
However, when I want to remember the current working directory by means of pushd ., I ...