Linux considers a file or folder hidden if the name starts with a dot (.). File managers such as GNOME Files or Dolphin will not show hidden files and folders by default. It is also the case when using command-line tools such as ls.

You can rename a file or folder and prepend a . to its name to hide, and removing the leading . to unhide. It is different from Windows as files and folders are visible or hidden based on file/folder attributes rather than the name.

You can rename a file or folder to hide and unhide them using graphical files managers or by using mv command at the terminal.

Steps to hide and unhide files and folders in Linux:

  1. Launch terminal
  2. List files and folders in a folder using ls.
    $ ls temp/
    file  folder
  3. Rename an existing file by prepending . to its name using mv to hide a file.
    $ mv temp/file temp/.file
  4. Run ls to list files and folders in the previous folder.
    $ ls temp/
    folder
  5. Rename the hidden file by removing the leading . using mv to unhide the file.
    $ mv temp/.file temp/file
  6. Run ls again to list the files and folders in the folder.
    $ ls temp/
    file  folder
Discuss the article:

Comment anonymously. Login not required.

Share!