How to Show Hidden Files in Ubuntu Terminal

In Linux, a “hidden file” is simply any file or directory whose name begins with a period (for example, .bashrc or .ssh). The operating system hides these files by default to keep your directories looking clean and to prevent accidental modification, as they almost always contain critical software configurations or sensitive security keys.

When you navigate a Linux server via a terminal and type the standard ls (list) command, the terminal will only show you the standard, visible files, completely omitting the hidden configuration files sitting in the exact same directory.

How to List Hidden Files (The -a Flag)

To force the terminal to reveal every single file in a directory, including the hidden ones, you must append the “all” flag to the list command.

  1. Open your terminal and navigate to your home directory (type cd ~).
  2. Type the following command and press Enter:
ls -a

The terminal will instantly output a list of files. You will immediately notice several files and folders that were previously invisible, all starting with a dot, such as .bash_history, .profile, and .cache.

You will also notice two strange entries at the very top: a single dot (.) and a double dot (..). These are system pointers representing the “current directory” and the “parent directory” respectively, and are perfectly normal.

How to View Hidden Files in a Detailed List

While ls -a shows you the names of the hidden files, it outputs them in a crowded, horizontal grid that can be difficult to read. It also fails to tell you file sizes or permissions.

To get a highly readable, vertical list containing all the metadata for both normal and hidden files, you should combine the “all” (-a) flag with the “long format” (-l) flag.

  1. Type the following command and press Enter:
ls -la

This is arguably the most common command used by Linux administrators. It produces a perfectly formatted table displaying the permissions, owner, file size, modification date, and filename of every single item (hidden or visible) in the directory.

How to Hide a File Yourself

Because the Linux hiding mechanism is based entirely on the filename, you can hide any file you want simply by renaming it.

If you have a file named secret.txt and you want to hide it from the standard ls output, use the mv (move/rename) command to add a period to the start of its name:

mv secret.txt .secret.txt

The file will instantly vanish from standard views, remaining perfectly accessible to anyone who knows to use the ls -a command to look for it.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.