CDIR – A Faster Way to Navigate Folders and Files on Linux

Are you tired of running multiple cd commands and ls commands while searching files and directories on your system? cdir is a cool and easy-to-use command-line utility that provides a pleasant way to navigate the bash shell and search for files. It is written in Python and uses the curses module.

Let’s briefly have an overview of some of the features it provides:

Functionalities of cdir Command

  • Supports the use of arrow keys when navigating between directories and searching for files.
  • Searches files by simply typing the name of the file within a directory.
  • Supports Bash Shell, Windows Powershell & Command Prompt.

Here is the live preview of cdir command in action.

CDIR - Navigate Folders and Browse Files Quickly
CDIR – Navigate Folders and Browse Files Quickly

Installation of CDIR on Linux

To install CDIR use pip, which is Python’s package manager as shown. For this case, I’m using pip3 since it’s installed by default alongside Python3.

$ pip3 install cdir --user
Install CDIR Tool in Linux
Install CDIR Tool in Linux

Once installed, append an alias to the .bashrc file as shown:

$ echo "alias cdir='source cdir.sh'" >> ~/.bashrc

And finally, reload the .bashrc file.

$ source ~/.bashrc
Create Alias in Linux
Create Alias in Linux

To start searching files, run the cdir command:

$ cdir

This will display a list of folders in your current working directory and hidden files.

List Files and Folders in Linux
List Files and Folders in Linux

To search files, use the arrow up and down keys to navigate between directories. In the example below, all files under the Downloads folder have been displayed.

Search Files in Linux
Search Files in Linux

To quit using cdir tool, simply press the F11 key on your keyboard. And that’s just about it. Give it a test run and let us know how it went.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

26 thoughts on “CDIR – A Faster Way to Navigate Folders and Files on Linux”

  1. Hi All,

    I am a newbie to Linux. I tried the above in CentOS 8 but getting an error:

    "bash: cdir.sh: No such file or directory"
    

    I searched for cdir.sh using locate and found below.

    /root/.local/bin/cdir.sh
    

    Any suggestion would be very much helpful.

    Reply
        • It looks like you did your “pip3” as root (superuser) so you will only be able to run cdir as root. That’s probably not what you want. Make sure you’re not root and try the instructions again.

          Reply
  2. Neither F1 nor F11 exits cdir in Mint 19.3. Resize the window and the folder column disappears. This is a very good idea which is very nearly a winner for me, but it is still too flaky. You also forgot to remind us to log in again before trying it out.

    Reply
  3. Free copy-editing:

    “To search files, use the arrow up and down keys to navigate between directories. In the example below, all files under the Downloads folder have been displaced.”

    should be:

    To search files, use the arrow up and down keys to navigate between directories. In the example below, all files under the Downloads folder have been displayed.

    Reply
  4. I have asked the same question in Unix and Linux group also – https://unix.stackexchange.com/questions/591643/how-to-use-cdir-in-multiple-tmux-panes

    Reply
  5. Hi, I have a question regarding cdir.

    I use cdir python package to navigate between folders and it works very fine.

    But I have an issue in using it with tmux.

    I am explaining the situation below:

    I have started a tmux session in which in window 1, I have created 2 panes.

    In pane 1, if I type cdir it works fine.

    But after then if I navigate to pane 2 and then type cdir it comes as

    cdir: no_disc

    What is this error and how to overcome this?

    Reply

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.