Navigation auf


Department of Evolutionary Biology and Environmental Studies


qswitch - A quick way to switch directories in bash

I use the command line (bash shell) for almost everything. However, sometimes I found myself spending more time cd'ing from directory to directory than actually doing something useful ;-)

To avoid this, I wrote a perl script/bash function combination that allows changing directories using "aliases" predefined in a separate file. These aliases are searched for (partial) matches, and a "cd" to this directory executed. The perl script allows for TAB completion of the aliases, making very efficient switching possible. Aliases can easily be managed with dedicated options:


  • qsw --add mytag .
    qsw --add othertag /foo/bar
    creates aliases 'mytag' and "othertag" pointing to current directory and /foo/bar
  • qsw m[TAB]
    from anywhere, this command will "cd" to the directory previously associated with this alias. If 'm' does not uniquely define the tag, a few letters more need to be typed for successful TAB completion.

The script and instructions can be found on GitHub: