foxfirefey (
foxfirefey) wrote in
command_liners2009-06-25 11:51 am
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.png)
Entry tags:
Going to your previous current working directory
I learned this one recently from a coworker:
This will allow you to switch to your previous current working directory. So:
This is really useful if you have two main directories you're currently working in.
cd -
This will allow you to switch to your previous current working directory. So:
# Go into first directory cd ~/path/to/first/dir # Go into second directory cd ~/path/to/second/dir # This takes us back to the first directory cd - # This takes us back to the second directory cd -
This is really useful if you have two main directories you're currently working in.
no subject
no subject
no subject
no subject
Another way of switching between two directories is to use "pushd" with no arguments, which switches the top two directories in the "dirs" stack. So:
cd ~/fred
pushd ~/barney
(now in ~/barney)
pushd
(now in ~/fred)
pushd
(now in ~/barney)
Works with BSD, too.
Music: Kathleen MacInnes - Gaol Ise Gaol ("My Love is She") from 'The Highland Sessions'
no subject
For example, if I'm in /home/pne/src/foo/monitor/impl and want to have a look at my co-worker's sources, I could
cd pne rku
and end up in /home/rku/src/foo/monitor/impl.Or if I'm in /home/pne/proj/cool-app/src/com/example/coolapp/core/ui/buttons and want to have a look at the compiled classes, I could type
cd src bin
and end up at the appropriate position in the compiled-classes hierarchy (assuming a fairly typical(?) setup).Pity that AFAIK bash hasn't adopted this syntax, especially since (again AFAIK) it doesn't conflict with any existing syntax.
no subject
cd ${PWD/pne/rku}
, although that's admittedly not easy to remember at all.