Gogo is an impressive way to bookmark directories inside your shell. It allows you to create shortcuts to long and complicated paths in Linux. This way, you don’t have to type or remember long and complicated paths anymore in Linux.
How to Install Gogo in Linux Systems
To install Gogo, first clone the gogo repository from Github and then copy the gogo.py to any directory in your PATH environmental variable (if you already have the ~/bin/ directory, you can place it here, otherwise create it).
$ git clone https://github.com/mgoral/gogo.git $ cd gogo/ $ mkdir -p ~/bin #run this if you do not have ~/bin directory $ cp gogo.py ~/bin/
Then add a function from gogo.sh to your ~/.bashrc (for Bash) or ~/.zshrc (for Zsh) file and verify it as shown.
$ cat gogo.sh >> ~/.bashrc $ tail ~/.bashrc OR $ cat gogo.sh >> ~/.zshrc
How to Use Gogo in Linux Systems
To start using gogo, you need to logout and login back to use it. Gogo stores its configuration in ~/.config/gogo/gogo.conf
file (which should be auto-created if it doesn’t exist) and has the following syntax.
# Comments are lines that start from '#' character. default = ~/something alias = /desired/path alias2 = /desired/path with space alias3 = "/this/also/works" zażółć = "unicode/is/also/supported/zażółć gęślą jaźń"
If you run gogo run without any arguments, it will go to the directory specified in default; this alias is always available, even if it’s not in the configuration file, and points to $HOME directory.
To display the current aliases, use the -l
switch. From the following screenshot, you can see that default points to ~/home/rootadminz which is user rootadminz’s home directory on the system.
$ gogo -l
Below is an example of running gogo without any arguments.
$ cd Documents/Phone-Backup/Linux-Docs/ $ gogo $ pwd
To create a shortcut to a long path, move into the directory you want and use the -a
flag to add an alias for that directory in gogo, as shown.
$ cd Documents/Phone-Backup/Linux-Docs/Ubuntu/ $ gogo -a Ubuntu $ gogo $ gogo -l $ gogo -a Ubuntu $ pwd
You can also create aliases for connecting directly into directories on a remote Linux server. To do this, simply add the following lines to gogo configuration file, which can be accessed using -e
flag, this will use the editor specified in the $EDITOR env variable.
$ gogo -e
One configuration file opens, add these following lines to it.
sshroot = ssh://root@192.168.56.5:/bin/bash /root/ sshtdocs = ssh://rootadminz@server3 ~/rootadminz/docs/
To display the gogo help message, use the -h
option.
$ gogo -h
One notable limitation of gogo is its lack of support for auto-completion – when accessing subdirectories/child directories under an aliased long path.