I'm constantly going 'cd ../../../../'. Is there a command/alias that could let me go 'cmd 4' and I'd be taken back 4 directories?
migrated from stackoverflow.com May 10 '11 at 22:55
|
Put this in your
(The name |
|||||||
|
|
Two thoughts that might be of use to you:
|
|||
|
|
|
Here is an alternative way:
|
|||
|
|
|
I use autojump which allow me to type :
it can learn from your habits and is very light (and addictive ;) ) |
|||
|
|
You might want to look into using You could also set a variable with the name of a directory you use a lot, then CD there:
|
|||
|
|
|
Quick and dirty:
Formulated to only change directory once. |
|||
|
|
|
Sure, why not:
up() {
[ $# = 0 ] && cd .. && return
[ $1 = 0 ] && return
cd .. && up $(($1 - 1))
}
|
|||||||||||||||
|
|
I was taught to use 'pushd' and 'popd' for such circumstances. For example, type 'pushd .' and then 'cd /home'. Now type 'popd' and you will be back to where you started. 'pushd'/'popd' is a stack, you can push as many directories on there as you like, but it is last on, first off when you popd. |
|||
|
ls? Surely you meancd? – Chris Jester-Young May 10 '11 at 14:04alias cmd5 = "cd ../../../../../"– ypercube May 10 '11 at 14:05