Shell tool to move in a complex directory structure [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionMy development machine is a linux host.
I have a complicated directory structure (like most of you, I assume), and I would like to move easily from one directory to the other, from within the shell. Specifically, welcomed features would be:
- autocompletion (something like ido-mode in emacs)
- regular expression directory / file matching
- suggestion of recently visited directories (stack).
- Possibilty to push/pop to the stack, get a listing of recently visited directories, ...
- good integration of those features
- console based
Do you know any tool which can satisfy those requirements?
In bash you can set CDPATH to a colon-separated directories that bash will search for when the argument to the cd does not exist.
$ man bash|grep -A3 '^\s\+CDPATH '
CDPATH The search path for the cd command. This is a colon-
separated list of directories in which the shell looks
for destination directories specified by the cd com‐
mand. A sample value is ".:~:/usr".
Once set, autocomplete will just work the way you'd expect it:
$ export CDPATH=dir1:dir2
$ cd somedir<tab>
Besides the current directory, bash will look into the directories in $CDPATH for the possible values.
Umm, any interactive shell(say, bash) already has nearly all of these features:
- Press Tab once to auto-complete, and twice to show a list of possible completions.
find | grep reg.exp
can be used for file matching, orfind -exec grep reg.exp -H '{}' ';'
to match contents- You can switch to the previous directory with
cd -
pushd
andpopd
can be used to push and pop directories
精彩评论