Goto – Quickly Navigate to Aliased Directories with Auto-Completion Support

In a recent article, we talked about Gogo – a tool to create shortcuts for long paths in a Linux shell. Although gogo is a great way to bookmark your favorite directories inside a shell, however, it has one major limitation; it lacks an auto-completion feature.

Because of the above reason, we went all out to find a similar utility with auto-completion support – where the shell can prompt with suggestions of the available aliases (shortcuts to long and complicated paths) and luckily, after crawling through Github, we discovered Goto.

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 auto complete 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.

Goto - Navigate Quickly to Aliased Directories

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/Tecmint.com-Articles/March/
Create Alias for Directory in Linux

Create Alias for Directory in Linux

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 -l flag.

$ goto -l
Check Available Aliases in Linux

Check Available Aliases in Linux

To expand an alias to its value using the following command.

$ goto -x scripts
$ goto -x march
Expand an Alias Value

Expand an Alias Value

Goto also allows you to unregister an alias, using the -u option.

$ goto -l
$ goto -u march
$ goto -l
Remove Directory Alias in Linux

Remove Directory Alias in Linux

If you have removed aliased directories (for example if you have deleted the directories ~/Documents/Tecmint.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 -c flag.

$ 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 -h option.

$ goto -h

Goto Github repository: https://github.com/iridakos/goto

Goto is a powerful way to bookmark your favorite directories inside a shell, with auto-completion support, in Linux. It has more useful features compared to Gogo, as explained above. Give it a try and share with us, your thoughts about it via the feedback form below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.