There are some options.
1. Fuzzy finder
A utility, fuzzy finder, will do exactly what you want. Fuzzy finder is in the Ubuntu repositories (at least as of 19.04) and can be installed with
sudo apt get install fzf
Alternatively, it can be installed from its github page.
Once installed, at the prompt, press Alt+c. You immediatelly can start typing the name of a folder underneath the folder where you are. When the name appears, select it and press Enter to cd
into it.
WHen typing a command, Ctrl+T will allow you to search and put any name of a folder or file on the command line.
2. Your bash history
- Type Ctrl+r: this starts reverse search in your history
- type
pro
(i.e. the actual name of your project): likely, you recent command cd /path/to/project
will already have popped up.
- Press Enter to execute the command
This will reduce your effort to four, five keystrokes. If another matching (more recent) command pops up, press Ctrl+r again to continue the reverse search.
Also typing just cd
after Ctrl+r already will list the last cd command used. Continue pressing Ctrl+r to cycle through previous cd commands. However, the chance that your folder name is more unique and thus is found quicker, is higher.
3. Rofi or dmenu
With rofi or dmenu, you can easily create small menu's that dynamically represent your recent folders. rofi (or dmenu) takes a text file as input for menu items. The output of the command history | grep cd
can be displayed to you through rofi as following:
history | grep cd | rofi -dmenu
Place this in a small script, and bind a hotkey to it. The hotkey will now display all your recent cd
commands. Type a few letters of the directory to narrow down the list.
4. Other options
- Make aliases to the commands you know you will be repeating
- Make small scripts to run the commands you know will be repeating
cd <tab>
gives you all the subdirectories in the current directory. It is a general feature suggesting also command and file name completions. – muclux Jan 04 '19 at 14:02fish
in the Ubuntu repositories) does this by default. – Nonny Moose Jan 05 '19 at 02:46