Jump! Quick directory change at the command line
Database Based
You can easily jump into directories that autojump keeps in its database using the j
wrapper. For example, j Dow
would take you to the ~/Downloads
directory. In the same way, j loa
also takes you there. The depth of the directory hierarchy is not important; the main thing is that you visited the desired directory at least once using cd
.
If you want to switch to your file manager for a better overview, jo Dow
opens the directory for Plasma in Dolphin or for Gnome in Nautilus (Figure 2). If you just enter j
, the command jumps to the most frequently visited directory, for which Autojump uses internal weighting.
If you call the content of the database with j --stat
, you will see different numbers in front of the respective paths, for example:
22.4: /home/devil/Downloads/piwik
This sequence of digits is the internal weighting (Figure 3). As an example, the following directories are in the database:
If you enter j in
, high weighting causes autojump to switch to /home/user/mail/inbox/
, whereas j w in
would be the correct command to access the lower weighted directory. You can use the --increase
(-i
) and --decrease
(-d
) parameters to change the weighting, and j --help
for additional information about syntax.
Alternatively, if you have several similar directories, you can display the numbered entries by means of tab-based autocompletion and then select the corresponding entry by number.
A helpful tip when using autojump: Sometimes the database suddenly empties, which can be extremely annoying, because you then have to start indexing from scratch. Sometimes it is better to back up the database manually.
Turbo
Fasd [4], the final tool covered in this article, was inspired by autojump. However, the software exceeds its role model: Fasd no longer restricts the navigation options to the directory tree, and it also indexes the data. Fasd works with the Ash, Bash, Zsh, mksh, pdksh, dash, and BusyBox shells under Linux, as well as /bin/sh
in FreeBSD 9 and OpenBSD.
Fasd lets you open files by entering just a few characters in Vim or your default editor. You can view PDFs or play movies and music with MPlayer or your favorite player. The letters in the Fasd acronym stand for predefined aliases that process different types of data.
When you enter f
, the tool shows you the visited files, including their weighting. Entering d
provides the same result for the directories, and a
lists both. zz
takes you to a view in which you select an entry by the prefixed number (Figure 4).
Defining additional aliases lets you open various files: for example, PDFs (Figure 5). In turn, you can create the following proxy in .bashrc
:
alias o='a -e xdg-open'
Now source the file, as shown in Listings 2 and 3. The following also applies: Like autojump, Fasd only detects objects that have already been indexed.
Movies and music also can be started with just a few keystrokes. For this to work, enter
alias m='f -e mplayer'
in .bashrc
. Alternatively, use a different player or change the m
call switch to another. Then, simply start the movies or music using m<part of title>
.
Like autojump, Fasd also lets you use letters from the middle of the name. The aliases' structure is simple: -e
stands for execute. For files, select f
; for directories, d
. If the alias includes both, as with xdg-open [5], select a
. On GitHub, the project provides an overview of the tool's many other possibilities.
Conclusions
All three tools presented in this article have one thing in common: They do not run in drop-down terminals, such as Yakuake or Guake, just in consoles or terminals. However, you will not read this anywhere, which led to me occasionally doubting the tools' capabilities in the lab. All three helpers are meaningful, and they build on each other.
If you do not constantly work at the command line, bd makes it easy to navigate without having to learn something new. Autojump offers much more and jumps into directories in random directions. This suits the workflow of users who frequently work on servers and like to handle administrative work at the command line. After the introduction phase, autojump saves some time here.
Fasd expands the feature set again, because it also indexes files and thus takes control of all the files on the computer. It also offers professional options to further customize the approach to suit your own needs.
Infos
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Endless OS 6 has Arrived
After more than a year since the last update, the latest release of Endless OS is now available for general usage.
-
Fedora Asahi 40 Remix Available for Macs with Apple Silicon
If you've been anticipating KDE's Plasma 6 for your Apple Silicon-powered Mac, then you're in luck.
-
Red Hat Adds New Deployment Option for Enterprise Linux Platforms
Red Hat has re-imagined enterprise Linux for an AI future with Image Mode.
-
OSJH and LPI Release 2024 Open Source Pros Job Survey Results
See what open source professionals look for in a new role.
-
Proton 9.0-1 Released to Improve Gaming with Steam
The latest release of Proton 9 adds several improvements and fixes an issue that has been problematic for Linux users.
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.