I do this too often:
$ pwd /a/long/long/way/from/anywhere $ cd # oops - meant to tab-complete something /home/$USER
Can cd
defaulting to $HOME be disabled?
I do this too often:
$ pwd /a/long/long/way/from/anywhere $ cd # oops - meant to tab-complete something /home/$USER
Can cd
defaulting to $HOME be disabled?
Two options I can think of:
you can write an
alias
to defaultcd
without arguments to whatever you want. This is in the line of using utilities likecdargs
orapparix
. Personally, I have been using thiscd
replacement for quite a long time.patch
bash
to behave differently (bash-4.2/builtins/cd.def
). Not sure if changing this default breaks other things, though.In bash, if you accidentally change to the wrong directory, you can go back to the previous directory with:
This alias seems to do it:
I don't think it has any dangerous side effects...