Command Line Tools for Faster File System Navigation

alpha2phi
7 min readMay 23, 2021

Command-line utilities to replace “cd command for faster file system navigation.

Photo by Hannah Joshua on Unsplash

Overview

In some of my previous articles, I walked through with you tools that could improve your development workflow. One of the command-line utilities is autojump which is a faster way to navigate the filesystem.

For developers, we mostly live within the terminal. Having a faster way to navigate the filesystem can definitely improve our productivity. In this article let’s explore the possible options we have.

Jumping Between Directories

Built-in Commands

Let’s start with some of the built-in commands.

  • alias: You can easily create alias for the most commonly used directories, e.g. your project folder
$ alias p="cd $HOME/projects"
  • Reverse/forward search: You can do a reverse search (Control-R), or forward search (Control-S) for the command history.
  • cd-: Use “cd-” to go back to the previous directory. You can also add a number to indicate how many folders you want to go back to, e.g. “cd-2
  • pushd, popd and dirs: Use pushd to save the current directory to the top of the directory stack and change the current directory to the folder. dirs to display the directory stack.popd to remove the top directory from the stack and navigates to the new top directory.

There are possibly more options than I listed above.

autojump

autojump is definitely one of the most popular options. autojump works by maintaining a database of the directories you use the most from the command line. Directories must be visited first before they can be jumped to.

Once installed,

  • j foo: Jump to a directory containing foo.
  • jc bar: Jump to a child directory.

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.