Published on Apr 10, 2019
in category programming
I use the terminal a lot and in my day to day work I tend to navigate to the same bunch of directories.
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).
User registers directory aliases, for example:
goto --register dev /home/iridakos/development
and then cds to that directory with:
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 :)
goto all you have to do is clone the repository locally:
git clone https://github.com/iridakos/goto.git
navigate to it
You need to restart your shell after installation.
To change to an aliased directory, type:
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
gotoexpands 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.
tabkey after the alias name, you have the default directory suggestions by the shell.
To unregister an alias, use:
goto -u <alias>
goto --unregister <alias>
goto -u last_release
goto --unregister last_release
tab key after the command (
--unregister), the completion script will prompt you with the list of registered aliases for your convenience.
To get the list of your currently registered aliases, use:
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:
To view the tool’s help information, use:
To view the tool’s version, use:
To first push the current directory onto the directory stack before changing directories, type:
goto -p <alias>
goto --push <alias>
To return to a pushed directory, type:
This command is equivalent to
popd, but within the
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
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.