Goto is a shell utility to quickly navigate to aliased directories, with support for auto-completion. It comes with a nice auto-completion script so that once you press the tab key after the goto command or after typing a few charters of an existing alias, bash or zsh prompts with suggestions of the aliases or autocomplete the name, respectively.
Goto also has additional options for unregistering an alias, expanding an alias’s value as well as cleaning up aliases of deleted directories. Note that goto’s auto-completion only works for aliases; it is separate from shell auto-completion for commands or filenames.
How to Install and Use Goto in Linux Systems
To install Goto, start by cloning the goto repository from Github and move into the local repository directory, then run the install shell script with root user privileges using the sudo command as shown.
$ cd Downloads/ $ git clone https://github.com/iridakos/goto.git $ cd goto $ ls $ sudo ./install
This will install goto in /usr/local/share/goto.sh, and it will add a line in your ~/.bashrc (for Bash) or ~/.zshrc (for Zsh) shell startup file, to source it.
Now restart your terminal to start using goto. To create an alias for a directory, register the alias with the -r flag as follows.
$ goto -r march ~/Documents/rootadminz.com-Articles/March/
To alias your current directory, use this syntax which will automatically be aliased to the whole path.
$ goto -r home
When you type goto and press the tab key, it will show all registered aliases and when you type a few letters of a registered alias, goto will auto-complete the name. However, to view a list of your currently registered aliases, use the
$ goto -l
To expand an alias to its value using the following command.
$ goto -x scripts $ goto -x march
Goto also allows you to unregister an alias, using the
$ goto -l $ goto -u march $ goto -l
If you have removed aliased directories (for example if you have deleted the directories ~/Documents/rootadminz.com-Articles/March and ~/bin/shellscripts/recon from the filesystem), yet they still have aliases in goto, you can cleanup all these aliases from goto with the
$ goto -c
A significant limitation of goto is that it doesn’t allow for accessing a sub-directory under an aliased directory, which is a feature present in Gogo.
For more information, consult the goto help message with the
$ goto -h