Questions tagged [pushd]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
49
votes
13answers
14k 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?
387
votes
10answers
387k 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 ...
66
votes
3answers
51k views

Difference between “cd -” and “cd ~-”

The Bash command cd - prints the previously used directory and changes to it. On the other hand, the Bash command cd ~- directly changes to the previously used directory, without echoing ...
21
votes
1answer
23k views

pushd, popd vs cd, cd- in bash and zsh

Is there a difference between the behavior of pushd/popd in bash vs zsh? It seems in zsh cd, cd- behaves exactly the same as pushd/popd (which adds/pops directory automatically when cd) while in bash ...
43
votes
2answers
12k 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 ...
6
votes
2answers
3k 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 /Volumes/...
0
votes
2answers
143 views

Directory stack (pushd and popd) behaviour in bash scripts

If I poorly write a script that uses pushd /etc but I don't finish it with popd: Will /etc still be in the pushd+popd directory stack/in RAM after the bash script has finished executing and Bash has ...
0
votes
1answer
1k views

How does pushd work?

In Ubuntu 16.04 with Bash I had a problem when I didn't have a convenient way to upgrade all my WordPress components (core, translations, theme, plugin) and I used the following code to solve it: cat ...