开发者

Shell tool to move in a complex directory structure [closed]

Closed. This question is off-topic. It is not currently accepting answers. 开发者_运维技巧

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

My 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, or find -exec grep reg.exp -H '{}' ';' to match contents
  • You can switch to the previous directory with cd -
  • pushd and popd can be used to push and pop directories
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜