How to alias and navigate to directories with autocomplete in Linux

A Linux shell script for registering directory aliases and navigating to them with tab completion.
I just released stup, a tool for easily keeping organized daily notes in the terminal. You can find it on GitHub here.

I use the terminal a lot and in my day to day work I tend to navigate to the same bunch of directories.

There are some awesome tools out there (like autojump or z) but sometimes, especially when the directories are similarly named, there is a need to be explicit to navigate to the proper one.

I decided to write a script to overcome this issue and to avoid having to edit my .bash* files to manage aliases each time I wanted to add or remove a directory.


goto is a shell utility to quickly navigate to aliased directories with autocomplete (tab completion).

goto repo at GitHub

goto gif

User registers directory aliases, for example:

goto --register dev /home/iridakos/development

and then cds to that directory with:

goto dev

Find below documentation on the script but make sure you check the script’s documentation page for updates.

Sorry for the name, I know it brings back memories but it’s not what it seems :)


To install goto all you have to do is clone the repository locally:

git clone

navigate to it

cd goto

and execute:

sudo ./install

You need to restart your shell after installation.


Change to an aliased directory

To change to an aliased directory, type:

goto <alias>


goto dev

Register an alias

To register a directory alias, type:

goto -r <alias> <directory>


goto --register <alias> <directory>


goto -r blog /mnt/external/projects/html/blog


goto --register blog /mnt/external/projects/html/blog


  • goto expands the directories hence you can easily alias your current directory with:
    goto -r last_release .

    and it will automatically be aliased to the whole path.

  • Pressing the tab key after the alias name, you have the default directory suggestions by the shell.

Unregister an alias

To unregister an alias, use:

goto -u <alias>


goto --unregister <alias>


goto -u last_release


goto --unregister last_release


Pressing the tab key after the command (-u or --unregister), the completion script will prompt you with the list of registered aliases for your convenience.

List aliases

To get the list of your currently registered aliases, use:

goto -l


goto --list

Expand an alias

To expand an alias to its value, use:

goto -x <alias>


goto --expand <alias>


goto -x last_release


goto --expand last_release


To cleanup the aliases from directories that are no longer accessible in your filesystem, use:

goto -c


goto --cleanup


To view the tool’s help information, use:

goto -h


goto --help


To view the tool’s version, use:

goto -v


goto --version


Push before changing directories

To first push the current directory onto the directory stack before changing directories, type:

goto -p <alias>


goto --push <alias>

Revert to a pushed directory

To return to a pushed directory, type:

goto -o


goto --pop

This command is equivalent to popd, but within the goto command.

Behind the scenes

Upon installation, a line is appended to your .bashrc file which sources the script, registering a goto function responsible for changing the directory based on the defined aliases of the database.

The script creates a directory alias database file under ~/.goto. Every register or unregister action modifies this file.

The script also uses the Bash programmable completion feature to define tab completions resolved via extraction of the aliases defined in the goto database file.

That’s all! Cat photo.

I'll be back

Code and comments
You can find the code of goto at
For feedback, comments, typos etc. please open an issue in the repository.
Thanks for visiting!