Tired of typing long paths or hunting through cd history? dirjumper lets you bookmark any directory with a short alias and jump to it instantly from anywhere.
The
upstreambranch contains the currently developed version, while themasterbranch holds the stable release.
Requirements: bash shell with read/write access to the current directory. wget or curl must be available.
Run one of the following in a writable directory:
With wget:
wget https://raw.githubusercontent.com/akoskovacs/dirjumper/master/dj.sh && bash dj.sh install && rm dj.shWith curl:
curl -sSL https://raw.githubusercontent.com/akoskovacs/dirjumper/master/dj.sh > dj.sh && bash dj.sh install && rm dj.shThe installer will set everything up and clean up after itself automatically.
ℹ️ Windows: This also works in GNU-type environments (e.g. Git Bash, WSL). If
~/.bashrcdoes not exist yet, create it first:touch ~/.bashrc
Navigate to the directory you want to bookmark, then add an alias:
$ cd /var/log/cups
$ j -a cuThe current directory is now bookmarked as cu.
You can also bookmark any path without navigating to it first:
$ j -a apt /etc/apt/sources.list.d$ j apt
$ pwd
/etc/apt/sources.list.d
$ j cu
$ pwd
/var/log/cups$ jOutput:
cu /var/log/cups
apt /etc/apt/sources.list.d
If your current working directory has a known alias, it will be preceded by a + sign and highlighted in green.
$ j -r cu cps
$ j cps
$ pwd
/var/log/cups$ j -d cpsAnd cps is forgotten forever. 😢
The -g flag returns the path for a given alias, making it easy to use in subshells:
$ ls $(j -g apt) # list /etc/apt/sources.list.d
$ cat $(j -g apt)/official-package-repositories.listdirjumper can upgrade and downgrade itself using the -u and -w options. Upgrading requires an internet connection and wget.
Upgrading:
$ j -u
[+] Checking for new version (current is v0.4.0)...
[+] New version (v1.1.0) found...
[?] Do you want to upgrade? [y/N]: y
...Downgrading (revoking an upgrade):
$ j -w
[+] Sucessfully downgraded from '0.2.0' to '0.1.1'.The installer places the script in $HOME/.config/.dirjumper/, along with a dj.list file where your aliases are stored.
⚠️ These are not shell aliases — they are dirjumper's own alias list, stored indj.list.
The installer also appends a small snippet to your .bashrc:
# <dirjumper>
source /home/akos/.config/.dirjumper/dj.sh
# </dirjumper>The <dirjumper> tags act as markers so future versions can safely update the snippet without breaking your config.
The following environment variables can be set in your .bashrc, inside the dirjumper tags. Be aware that upgrading dirjumper may overwrite custom values placed there.
Changes the command used to invoke dirjumper. Default is j.
# <dirjumper>
export DIRJUMPER_ALIAS="go" # use "go <alias>" instead of "j <alias>"
source /home/akos/.config/.dirjumper/dj.sh
# </dirjumper>Set to 0 to disable colored output. Any non-empty value other than 0 also disables colors.
# <dirjumper>
export DIRJUMPER_COLOR=0 # disable colors
source /home/akos/.config/.dirjumper/dj.sh
# </dirjumper>| Command | Description |
|---|---|
j <alias> |
Jump to the directory for <alias> |
j |
List all aliases |
j -a <alias> |
Bookmark the current directory as <alias> |
j -a <alias> <path> |
Bookmark <path> as <alias> |
j -r <old> <new> |
Rename an alias |
j -d <alias> |
Delete an alias |
j -g <alias> |
Print the path for <alias> (for use in scripts) |
j -u |
Upgrade to the latest version |
j -w |
Downgrade to the previous version |
