Hund

How to visually hide files and folders in Ranger

Thursday, July 30, 2020

Most users are probably already familiar with the common way to hide files and folders in Linux based operating systems, which is by adding a dot to the beginning of the file or the folder.

That is not always a desirable solution and sometimes not even an option. One example would be the folder ~/Desktop for me, it’s a folder that I never use. I don’t even have a “desktop” to begin with, but I can’t just hide it by renaming it to “.Desktop”. If I did it would just be recreated.

With the help of the plugin plugin_file_filter.py it’s possible to visually hide files and folders you don’t want to see. If you want to temporarily view the hidden files and/or folders again you can just temporarly set the setting show_hidden to true.

Installation

Start by creating the folder ~/.config/ranger/plugins/:

$ mkdir ~/.config/ranger/plugins/

Save the script to the newly created folder. In the script you then have this part:

HIDE_FILES = ("/boot", "/sbin", "/proc", "/sys")

Edit that part to your liking and just restart Ranger for the changes to take effect.

Meta

Feedback

If you want to leave any feedback, feel free do so by either sending me a message via e-mail, XMPP or IRC.