Monday, February 13, 2017

Sote - speeding up command line navigation

Sote is described by its author as "shell favorites paths, for faster cd".  In short, it allows the user to "name" a much-used path, allowing for faster navigation to/from multiple directories with fewer keystrokes.

Sote is similar to pushd [1] in that they both use similar means to facilitate navigation.  Sote is different from pushd in that it avoids use of the stack model and allows for a separate (and persistent) saved name for the target directory (e.g., "html" or "h" for "/var/www/html/", "b" for "/usr/local/etc/bitlbee/").

Sote is written in Bash.  In short, it self installs as a hidden file and appends itself to the users .bashrc file.


Installation is simple.

1) Run

  git clone ~/.sote

2) If needed, exampine the code in the ~/.sote folder.  The executable scripting is in ~/.sote/bin/sote.

3) Run


4) (OPTIONAL) I took sote's idea a bit further, by aliasing sote to a single keystroke ("z"), so that navigation involves even fewer keystrokes (example: "z h" for "cd /var/www/html/").  It may not seem like much but, for command line users, use of the tool can become habitual very quickly.

Note: in Ubuntu, you can alias "sote" to "z" by adding the following to ~/.bash_aliases

  alias z = "sote"

5) Close and reopen the terminal window (or run "bash").  The reason for doing this is to load the new .bashrc (you'll see "source ~/.sote/bin/sote" or something similar attached to the end of .bashrc).

Using sote

You can now add your favorite paths into the tool.  Example (with my z alias for sote):

  z -a h /var/www/html
  z -a html /var/www/html
  z -a b /etc/bitlbee
  z -a sys /lib/systemd/system

The above are saved in a file named "~/.sote-store".  This is how the aliases are persistent across session.  You can also show or delete individual (or all) aliases using similar syntax.

You can then use the above to quickly jump between directories.  "z h" jumps to /var/www/html.  From there "z b" switches to /etc/bitiblee and "z sys" switches to the /lib/systemd/system directory.  Note that you can save/use more than one path alias for the same path.

To see all of the available switches for sote, run "sote" or "sote -h".


No comments:

Post a Comment