Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 dirjumper

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.

dirjumper demo

The upstream branch contains the currently developed version, while the master branch holds the stable release.


📋 Table of Contents


📦 Installation

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.sh

With curl:

curl -sSL https://raw.githubusercontent.com/akoskovacs/dirjumper/master/dj.sh > dj.sh && bash dj.sh install && rm dj.sh

The 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 ~/.bashrc does not exist yet, create it first:

touch ~/.bashrc

🔧 Usage

➕ Adding a new alias for the current directory

Navigate to the directory you want to bookmark, then add an alias:

$ cd /var/log/cups
$ j -a cu

The current directory is now bookmarked as cu.

📁 Adding an alias for an arbitrary directory

You can also bookmark any path without navigating to it first:

$ j -a apt /etc/apt/sources.list.d

⚡ Jumping

$ j apt
$ pwd
/etc/apt/sources.list.d
$ j cu
$ pwd
/var/log/cups

📊 Listing out the aliases

$ j

Output:

    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.

✏️ Renaming aliases

$ j -r cu cps
$ j cps
$ pwd
/var/log/cups

🗑️ Deleting an alias

$ j -d cps

And cps is forgotten forever. 😢

🛠️ Using the directory in a regular command

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.list

🔥 Living on the edge

dirjumper 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'.

📂 What is installed?

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 in dj.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.


⚙️ Configuration

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.

DIRJUMPER_ALIAS

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>

DIRJUMPER_COLOR

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>

📘 Quick reference

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

Releases

Packages

Contributors

Languages