0

I'm looking for shortcuts that would help me to navigate directories quickly and efficiently.

2 Answers2

1

If you mean "easily cd to that directory from anywhere", you can try CDPATH. This is a shell variable that contains a colon separated paths of directories under which to look for directories to cd into. For example, if the directory you want to have quick access to is /a/b/c/interesting_dir, then you'd put in $HOME/.bashrc:

CDPATH=.:/a/b/c

Then no matter what your current working directory can do cd int<TAB> to do tab completion on interesting_dir, then when you hit ENTER you'll wind up in /a/b/c/interesting_dir

1

You might add a short alias to your shell's login script file (e.g. ~/.bashrc if you are using the common default bash shell):

alias w='cd /full/path/to/the/dir/I/always/work/on`

When this alias is in effect, you can just type w and press Enter in the command prompt to switch into the pre-determined directory.

Setting up a GUI shortcut to open a terminal in a specific directory automatically can be tricky, depending on whether or not your Linux distribution starts individual terminal windows as equivalent to independent login sessions or not. If it does, the terminal emulator may not be able to override the directory the new login session starts in.

If the new terminal window is started as a sub-shell of the main GUI session, then it might be possible if a) your shell startup scripts (both system-wide and your personal one) don't include any commands like cd $HOME and b) your terminal emulator allows specifying a directory to start in. In the best case, it might be as simple as making a copy of the .desktop file that is used to start your terminal window normally, and adding a line to the [Desktop Entry] section of the copy:

Path=/full/path/to/the/dir/I/always/work/on
telcoM
  • 96,466