This post will guide you through how to create and view hidden files in Linux using both the command-line interface (CLI) and graphical user interface (GUI). We will explore different methods to hide files, view them when needed, and unhide them when necessary.
You can achieve this by renaming a file with a dot (.) using the command line or GUI. Viewing and unhiding files is just as easy with commands like ls -a
or using the “Show Hidden Files” option in the file manager.
Table of contents
Creating hidden File in Linux:
To hide a file in Linux, simply rename it and prepend a dot (.) to its filename because, in Linux, any file or directory that begins with a dot is treated as a hidden file.
Method 1: Using the CLI (Command Line Interface)
Use the command below to hide a file in Linux:
$> mv FILENAME .HIDDENNAME
mv
: The mv command is used to move and rename files using Terminal
After renaming, the file will no longer appear in standard file listings, e.g., when using the ls command, indicating that the file is now hidden.
Use the ls command with the -a option to locate the hidden file, because -a
option displays all files, including the hidden ones.

Method 2: Using the GUI (Graphical User Interface)
using GUI to hide the file in Linux
1: Right-click on the file you want to hide and select Rename.

2: Add a dot (.) at the beginning of the file name.

3: Click Rename to confirm.

Viewing a Hidden File in Linux:
Method 1: Using the CLI (Command Line Interface)
Use the command below to view the hidden files within the current working directory:
$> ls -a
-a
: This option displays all files including the hidden ones.

Method 2: Using the GUI (Graphical User Interface):
1: Open the file manager.

2: Click on the menu (often represented by three horizontal bars or an “options” icon) in the top-right corner.

3: Select Show Hidden Files from the dropdown menu, or press the shortcut Ctrl + H.

Once enabled, all hidden files will be displayed in the file manager.

Unhiding a Hidden File in Linux:
To unhide a hidden file, rename it and remove the leading dot (.) from its filename.
Method 1: Use the CLI (Command Line Interface) to unhide the file in Linux
Use the command below to unhide a file in Linux:
$> mv .HIDDENNAME FILENAME
mv
: The mv command is used to move and rename files using Terminal

Method 2: Using the GUI (Graphical User Interface) to unhide the file in Linux
1: Enable the display of hidden files using the Show Hidden Files option (Ctrl + H).

2: Right-click on the hidden file and select Rename.

3: Remove the leading dot (.) from the filename.

4: Click Rename to confirm.
The file will now appear as a regular, unhidden file in the file manager.

Viewing Hidden Files via Keyboard Shortcut:
To quickly toggle the visibility of hidden files in the file manager, use the keyboard shortcut:
Ctrl + H
This shortcut works in most Linux desktop environments, such as GNOME and KDE.
Knowing how to create and view hidden files in Linux helps keep your files organized and your workspace clean. You can hide a file by adding a dot (.
) before its name and view it later using ls -a
or the “Show Hidden Files” option in the file manager.