May 9, 2024

Display, Create, and Modify Hidden Files in Linux/Ubuntu Using Terminal and GUI

In this Linux tutorial, we will learn how to list, display, create, and modify hidden files by using a Linux terminal and GUI. This tutorial is based on the Linux Ubuntu version. However, everything explained in this tutorial can be used in other Linux distributions. The YouTube video tutorial accompanying this webpage tutorial is given below.

First, open a Linux terminal window by clicking on “Activities” and by typing in the search menu “terminal” or “shell”. Then, in the terminal, create a new folder in the home folder by typing

cd ~
mkdir test1

Let us navigate to this folder by typing

cd test1

In Linux, hidden files start with a “dot”. In American English, “dot” is called a period. In British English, a period is called “full stop”. That is, by using the American English language convention, in Linux, hidden files start with a period. Let us create, a hidden text file. We can do that by typing

touch .hidden_file.txt

The Linux command “touch” creates an empty file. Also, let us create a file that is not hidden. We do that by typing

touch not_hidden_file.txt

In the same folder in which the files are created, let us try to list the file. In the terminal window, type

ls -l

However, you will only see the file “not_hidden_file.txt”.

To see both hidden files and files that are not hidden type in the terminal window

ls -la

This should display all the files.

Now, let us learn how to edit the hidden files. First, make sure that you have Geditor installed. To do that type in the terminal window

sudo apt-get install gedit

Then, to edit the hidden file, type

gedit .hidden_file1.txt

and edit the file by typing some text. Next, let us learn how to display the file by using the Linux/Ubuntu GUI. Go back to the GUI, and open “Files” explorer (this is the default explorer for files in Ubuntu, you can find it by clicking on Activities and typing Files in the search menu), and navigate to the test1 folder we just created. You will see the file called “not_hidden_file.txt”. To display all the files, including the hidden files you should press CTRL+H. After pressing this combination of keys, you should see all the files in the folder.

Let us now clean up everything by erasing the created folder and files. Go back to the terminal and type

cd ~
rm -r test1