Hiding files and directories in Linux is very simple. All you have to do is append a period at the beginning of the name of the file/directory.
With terminal:
mv filename .filename
(This command also works with directories)
Some additional information about the mv
command; if the second argument is a directory, the first argument will be moved into that directory, rather than being renamed to it (regardless of whether the first argument was a file or a directory). If the first argument is a directory and the second is a file, you will get an error. If both the first and the second arguments are existing files, the second will be overwritten without prompting you! If you wish to be prompted before overwriting, add -i
to the command before either argument
To view hidden files and directories in a terminal, use ls -a
.
Without terminal:
Click on the file, press the F2 key and add a period at the beginning of the name. To view hidden files and directories in Nautilus (Ubuntu's default file explorer), press Ctrl+H. The same keys will also re-hide revealed files.