How to make files Hidden in Linux

Linux provides us the functionality to hide the files for security as per user preference, users can easily hide files by using some simple command or even use GUI for simplifying user involvement. This can especially be helpful if you want to hide your files or directories without having to share your personal information with colleagues and friends. Here is a detailed tutorial users can follow to hide files in their system –

Hiding files – 

  • Create a new file using cat command or make a new directory using mkdir or choose any of your current directory or file-
  • Now add data to your file which is sensitive and you wouldn’t like anyone to access it –
  • Append a dot in front of file by renaming the file using mv(move) command –
  • Now you have successfully hidden your file –Empty-Window


View hidden files –

After you have hidden your file, you must also be able to retrieve your hidden file

  • Using ls -a find your hidden file, ls on the other hand doesn’t display hidden files
  • Use cat command to view contents(make sure you use dot operator)
  • Or rename the file back to visible –

Using GUI to hide/view files –

  • You can right click on the file and add a dot operator in the beginning of the file to hide your important file
  • You can later view this file using CTRL+H

A simple script to hide files –

If you feel remembering commands is not a thing for you then you can use this simple script to hide any file just by entering the file name –

echo "Enter the file name to be hidden"
read x
mv $x .$x
echo "File sucessfully hidden"


Leave a Comment