How to hide files with a specific extension

Here's a little script I wrote for hiding LaTeX intermediate files:

alias hidetex='ls *?(aux|bbl|blg|brf|lof|log|lot|out|toc) -1 > .hidden'

I added it to the ~/.bash_aliases file, so now I just cd to the folder I want to hide the files, and type hidetex.

This is intended to be executed at specific folders, but you could make it more generic (e.g. for .bak files) and change it to perform the task recursively, adding a .hidden file to each folder, but that's a little more complicated.


If you place a full stop (or period) at the beginning of the name of the file it should hide it, for example:

.helloworld.txt

To view your now hidden file, click "view" on Nautilus then check "Show Hidden Files".


You could create a file called .hidden in your home directory. In this file you can put the names of all the files that you would like to be hidden, one per line.