The tag has no usage guidance.

learn more… | top users | synonyms

3
votes
3answers
27 views

When using popd, how to push the current directory onto the stack?

When using popd, how to push the current directory onto the stack?
3
votes
1answer
27 views

removing duplicates from pushd/popd paths

Context linux bash pushd/popd/dirs Problem The problem scenario is very similar to the one stated in this question: removing or clearing stack of popd/pushd paths ... however the goal is not to ...
1
vote
1answer
33 views

How can I get a persistent dirstack with unique entries in zsh?

The Arch Wiki has this interesting bit of zsh configuration: DIRSTACKFILE="$HOME/.cache/zsh/dirs" if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then dirstack=( ${(f)"$(< $...
1
vote
2answers
47 views

Detect pushd depth in bash?

I would like to be able to programmaticly detect when my pushd stack is non-empty, within a bash shell. Is there any way to detect this? Something akin to $SHLVL would be nice. But so far, the only ...
2
votes
1answer
129 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 ...
0
votes
1answer
37 views

Why is cd appending dirs like pushd?

I am using zsh in Babun (Cygwin with oh-my-zsh and some extras). I noticed some odd behavior, it looks like cd is behaving like pushd? { ~ } » mkdir foo { ~ } » pushd foo ~/foo ~ { foo } » popd ~ ...
2
votes
2answers
37 views

popd pushd, does dirstack stores the accessed directorys as a textfile-list somewhere?

I would like to use the recently accessed directories list for logging purposes. Does directory stack stores somewhere the list of folders used by popd and pushd as a text file? If yes where?
2
votes
1answer
83 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 ...
1
vote
1answer
880 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 (/usr/bin:/bin:/...
0
votes
1answer
243 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 ...
20
votes
6answers
3k 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?
3
votes
1answer
170 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
133 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
131 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 ...
4
votes
2answers
680 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/...
103
votes
5answers
97k 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 ...
5
votes
2answers
1k 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 ...
19
votes
1answer
3k 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 ...