The OCD in me wants directories I do not like the name of to be hidden since I do not interact with them directly.
How can I hide directories without using the dot notation?
The OCD in me wants directories I do not like the name of to be hidden since I do not interact with them directly.
How can I hide directories without using the dot notation?
Assuming you only care about hiding the files from showing up in nautilus, there is a bug on the GNOME Bugzilla about this. However, currently, that bug has not been resolved.
There is another way to hide files from appearing in nautilus. If you create a file called
.hidden
inside of a directory, any filename listed in the file will not be displayed.For example, below is a .hidden file that I created. This file will hide any files or folders named
b
ore
located in the same directory as the .hidden file.Below is a screenshot of the folder that contains the .hidden file. Note that you only see three files:
a
,c
, andf
. You do not see the .hidden file due to the '.' at the beginning of its name.The screenshot below is of the same folder as before. However, this time, I hit Ctrl+H to cause nautilus to display hidden files and folders. Notice how there are several additional files that show up. You now see several files that were previously hidden due to having names that began with a '.'. There are also now files called 'b' and 'e', which although not having names beginning with a '.', were hidden due to being listed in the .hidden file.
Files mentioned in the .hidden file will only be hidden in nautilus. Tools like
ls
will still display them. The .hidden file is also not recursive. It only affects files in the same directory as the .hidden file is in.Some people on the forum have gone ahead and created scripts for nautilus that make it easier to add files to the .hidden file. The first script includes a nice explanation about how to install and use the scripts, but the second script is a bit cleaner and shorter. Feel free to use either script to make your life a bit easier.
Unix and Linux only supports hiding folders that being with a
.
.If you really want to get them out of the way, but want them to not have
.
s, put them all in a.hidden
in the same directory as the file or folder you want to hide..hidden
will not be exposed by the file manager, and your files will not have a name change.From the command line you could try something like this in your
.bash_aliases
file:This adds a new command
lsh
that behaves likels
, but hides files listed in a.hidden
directory. (It also is missing some of its features like colorized output and column listings.)If you want to hide files, you are only left with renaming them with a preceding
.
, as is *NIX convention. Sorry, but that's it.However, if you would like to hide the content of the files/directories, you can do so with file permissions.
So say you have a bunch of files in a folder called
secret_stash
, you could change it so that only you (the owner) haver-x
(read, execute) and everyone else has nothing---
(no access). Sincer-x
is the minimum perms needed to view a directory (read to access its contents and execute to be able to see them), anything inside of that folder is effectively hidden from everyone butroot
.NOTE: I'm running this demo as
root
, and trying to access the folder asmyuser
To do this you run
chmod 700 dirname
(700 meansrwx------
):And here it is:
Now and if I try to access it from
myuser
, attempts to access the folder or its contents fail:And now I've said the word "secret" so many times it's lost all meaning!!
1st off: if you want to hide a file from anyone: install a linux intrusion detection system. (Snort is an example) You can even hide a file from "root" but "root" will also be able to revert those setting.
But it might be easier to just set the permissions of the directory that holds the file to "root". Example:
And the file
1
is effectively hidden from view.Directory will be visible; file will not be visible. Mind though: "root" will ALWAYS have access to any file.
Together with the
chattr
you can even make the file immutable.and even "root" can not alter the file -unless- the
chattr
is reverted (and yes "root" can do that).No, this is something you need to do manually.
There's also an extension for Nautilus called nautilus-hide that will allow you to hide any file or folder with a simple right-click on them.
To install this extension :
sudo apt-get install nautilus-hide
in a terminal, or search for "nautilus hide" in the Ubuntu Software Center.Don't forget to quit Nautilus after installation : Alt+F2 and type
nautilus -q
.