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

James Kiarie

This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

22 Responses

  1. Navdeep says:

    I made a similar project using python a week back. I called it a teleporter but now that I see, cdir seems better.

    Anyways, check out the code here: https://github.com/nsr-py/Teleporter.

    Pardon the low quality, I am a rookie.

  2. Leandro says:

    Dude, just use zsh with oh-my-zsh for this task as everybody does.

  3. Cedric AMOUYAL says:

    Good idea!

    But F11 on Gnome put my terminal in full screen.

    How to exit on the current directory?

    Maybe add an exit on the screen.

  4. Paras Bhanot says:

    Or you could install ranger which will make this utility redundant.

  5. Sathish says:

    Hi,

    This is pretty nice to see.

    But, like Vic Caballero mentioned in the comment.

    cdir.sh is at ~/.local/bin
    

    Adding the export PATH command, as he had suggested, has helped to make this work.

    I also came to know about the source command through this article and that’s useful.

    Thank you for sharing :-)

  6. Findecanor says:

    Or … I could install Midnight Commander, which is a full-blown console-mode file manager.

    I find that the point of using “ls” and “find” is that I can get filtered file lists without clearing the console, which is then easy to copy and paste into the command line.

  7. Rutvik says:

    Nice, I’m gonna try this

  8. L. Torvalds says:

    Yes, fix something that is not broken.

    • James Kiarie says:

      I agree with you. However, I just decided to try out the tool on CentOS 8 and see how it compares to running the ls and cd commands. Honestly, I like it.

    • Pat says:

      Some of the greatness innovations in the world have been realized by fixing the unbroken.

  9. Ariel says:

    Interesting. I Will try it. Thanks

  10. Vic Caballero says:

    Hi,

    cdir.sh is actually installed at ~/.local/bin. So, the path needs to be modified.

    $ echo "export PATH=$PATH:~/.local/bin" >> ~/.bashrc
    
    • Vic Caballero says:

      My apologies, no need to modify a path, that is, if using bash. But if using sh, ~/.local/bin is not automatically included in the search path.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

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