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 commands or reasons for keeping stack with…
In terminal, how can I define a key to go to the previous directory which I was in when changing directory with the cd command?
For example, I'm in /opt/soft/bin and I cd into /etc/squid3 and I want to get back to the first directory.
I have a script that works when I run it from the command line, but when I schedule it with cron I get errors that it cannot find files or commands. My question is twofold:
When I schedule a cron job using crontab -e, does it use my user ID as the…
is there any way (what is the easiest way in bash) to combine the following:
mkdir foo
cd foo
The manpage for mkdir does not describe anything like that, maybe there is a fancy version of mkdir? I know that cd has to be shell builtin, so the same…
I want to run a script to simply change the current working directory:
#!/bin/bash
cd web/www/project
But, after I run it, the current pwd remains unchanged! How can I do that?
I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/.
But I don't want to type cd /[full-path]/ all the time. Are there any shortcut commands to…
One of the tutorials I've been following briefly stated that cd . has no use. When trying to replicate issue shown by OP in Symbolic link recursion - what makes it “reset”?, I also tried cd ., which showed the same effect OP described (growing $PWD…
I have my code mounted as an sshfs in my home directory, but the hierarchy is difficult to remember, so I created a symlink in my home directory leading to that directory. Is there a way so that when I cd to that symbolic link, instead of cding to…
Is there a way to execute a command in a different directory without having to cd to it? I know that I could simply cd in and cd out, but I'm just interested in the possibilities of forgoing the extra steps :)
Sadly, I only learned about this last year by stumbling upon it randomly on the internet. I use it so infrequently that I always forget what it is by the time I need it again.
How do you change to your previous directory?
As referenced in this fine answer, POSIX systems have an external binary cd in addition to the shell builtin. On OS X 10.8 it's /usr/bin/cd. You can't use it like the builtin cd since it exits immediately after changing its own working directory.…
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 anything.
Is that the only difference? What is the use…
I find that I often do the following:
%> cd bla/bla
%> ls
I would like it that whenever I cd into a directory it automatically does an ls.
I fiddled with my .bashrc for a while, but couldn't figure out how to make it happen.