I'm trying to hide some files with some command, I tried the rm command, but it did not work and also tried to rename but did not understand how it works. The files that I want to hide have spaces in their names and I just want to put the dot in front of the names to let them hidden. Can anyone help me?
You can use
mmv -v "*" ".#1"
Simple and to the point!
To un-hide them back:
mmv -v ".*" "#1"
rename 's/^/./' file1.txt 'file with spaces' 'third file.mkd'
You can of course use globs. The following will add a dot to the beginning of every file that ends with
rename 's/^/./' *.txt
Or you could hide every file beginning with
foo and ending with
rename 's/^/./' foo*.mkd
rename is using a substitute command:
s/foo/bar/ replaces the first
bar. Instead of
foo, you can also use a regular expression, and in regexes
^ means 'the beginning of the line'. So
rename to 'replace the beginning of the line with a
.'. That is: it places the dot before the first character.
You can also use the
-n option to do a 'test run' -- with that,
rename will not actually rename the files, but will list all the files that it would have changed, were you not using the
rename -n 's/^/./' *.txt
To quickly hide all files of the current directory from display in Nautilus:
ls * > .hidden
This will create a list of hidden files in the file
.hidden within the current directory. It will of course not hide these files on the command line, and if we chose to display hidden files from Nautilus they will show up again (as will
To only hide a subset of files use appropriate wildcards, or edit the
.hidden file with an editor.
To show all files again, just remove the
My prefered method is using "nautilus-hide" in "Nautilus-Actions-Extra" package:
sudo add-apt-repository ppa:nae-team/ppa sudo apt-get update sudo apt-get install nautilus-actions-extra nautilus-hide nautilus -q
After selecting files/folders in Nautilus, choose (Un)Hide > Hide from the context menu.
This creates a file named ".hidden" containing a list of files/folders to be hidden.