Sometimes when working in deeply nested file hierarchies (e.g. Java code) I find it annoying to traverse from one leaf to another. My usual cd-up looks like:

$ cd ../../..
# Oops, not enough
$ cd ..
# one more
$ cd ..

If I want to edit a file I can vim dir and interactively open desired file.
Is there some utility that allows to interactively change directory? Explorers/commanders (mc, vifm) are too heavy for such a task.

I have searched the internet, but my keywords seem to return nothing of relevance.

Added to clarify:

I am searching for an utility (let's call it vcd) that presents me an interactive directory tree which I can traverse and select where to cd.
From user perspective vim . calls hypothetical vcd which in the end executes vim $filename. I would like similar functionality (directory browser), just in the end to end up with CWD changed to interactively selected directory. I hope this makes my intentions more clear.

  • You mean - press a key and cd ..; ls is executed like how you use - command in vim directory browsing? – nitishch Jun 25 '15 at 8:59
  • with edbrowse you can do this w/ dirs, google.com, email, files, databases... maybe other stuff? – mikeserv Jun 25 '15 at 13:08
  • Take a look at deer and/or blscd. They use Miller columns and are meant to provide navigation, one for bash and one for zsh. – xaizek Jun 25 '15 at 20:13

Something like PC Magazine's DM from back in the DOS days... I don't know of a similar program on Linux, but I quite like xd for navigating around directories; with a function defined as

xd() {
    cd "$(/usr/bin/xd "$@")"

you can type for example

xd /ulb

which will print a list of all directories matching /u*/l*/b* (/usr/lib/binfmt.d, /usr/local/bin...), ask you to pick one and change to it.

  • hm, xd V3.22.09 doesn't understand my locale settings and doesn't support UTF-8. So, xd ф prints no solutions for ф but xd $'\xd1' prints 1: /home/.../ф – Evgeny Vereshchagin Jul 5 '15 at 11:04
  • 1
    Would you mind filing a bug (reportbug xd)? The Debian maintainer is xd's author so you'll be talking directly to the right person :-). – Stephen Kitt Jul 6 '15 at 17:05
  • thanks for the reminder. I should check the latest version of xd before sending a bug report:) – Evgeny Vereshchagin Jul 6 '15 at 17:26

Try fzf-fs.

Install fzf:

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf

Re-source your ~/.bashrc: . ~/.bashrc

Clone fzf-fs: git clone https://github.com/D630/fzf-fs ~/fzf-fs

Add ~/fzf-fs to your PATH: PATH=$PATH:~/fzf-fs
Run fzf-fs --init
Define an alias: alias vcd='. fzf-fs'
Run vcd ~
You should see something like this: enter image description here

Choose directory with Enter, use fuzzy searching, type [q] to exit.

See also: fzf-fs USAGE, fzf-fs doesn't support newlines in filenames fixed for cd!

  • That's really nice utility, thanks for the suggestion! – Fire-Dragon-DoL May 16 '17 at 1:51

While I do not know a tool that fits your description, perhaps some of the small utilities mentioned below would be helpful?

pushd and popd, described here along with other tools that can boost productivity while navigating around

fasd - offers quick access to files and directories for POSIX shells

autojump - a cd that learns

z - a variation on the above

v - z for vim

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.