DEV Community

Cover image for How to walk through the file system faster
Max Koshel for Nerdia

Posted on • Originally published at nerdia.io

How to walk through the file system faster

How much time do you spend surfing through the file system? Some people might prefer the visual interface over the console one or use a Norton Commander analogue. Or maybe someone has even configured autocompletion in their favorite console shell, but navigating through directories still hurts. A little magic, falks...

Fasd is a utility that serves to significantly improve the performance of the command line usage. Allows to receive fast access to files and directories. Now your navigation through the file system will be much faster, no matter what directory you are in.

Fasd by default is delivered with a number of aliases.

Go to the directory, in the path of which there is a substring abc:

$ z abc
Enter fullscreen mode Exit fullscreen mode

Equivalent to:

$ cd /home/user/path/to/abcdef
Enter fullscreen mode Exit fullscreen mode

Open a file to which you no longer remember the path /you/dont/remember/where/english_paper.pdf:

$ o eng paper
Enter fullscreen mode Exit fullscreen mode

You can also use fasd to pass the file path to any other command.

For example, open the file /etc/rc.local in the vim:

$ vim `f rc lo`
Enter fullscreen mode Exit fullscreen mode

Or move the file default to the directory /etc/nginx/sites-available:

$ mv default `d avail`
Enter fullscreen mode Exit fullscreen mode

Take a look at this small gif example of how to use it:

fasd usage example

How does fasd work? The first time you run fasd, it adds a hook, which will be executed on any command. The hook will scan your command arguments and determine if they refer to existing files or directories. If so, the fasd will add them to its database.

The utility uses frecency algorithm to understand which of the saved options to return from database. Frecency is a combination of the two concepts frequency and recency.

Fasd has a number of useful and convenient settings, as well as additional features. More detailed information in the github repository of the utility.

It's worth a try and you'll forget about visual file managers!

Top comments (1)

Collapse
 
3ginger profile image
German Gurov

TIL!