How To Show Hidden Files Linux : Using Ls Command In Terminal

Linux systems store configuration files with names beginning with a dot, and accessing them requires a simple command adjustment. If you’ve ever wondered how to show hidden files linux, the answer is straightforward once you know the right terminal commands or file manager settings. These hidden files, often called dotfiles, contain user preferences, application data, and system configurations that are intentionally kept out of sight to reduce clutter.

In this guide, you’ll learn multiple methods to display these files, whether you’re using the command line or a graphical interface. We’ll cover everything from basic commands to advanced techniques, ensuring you can manage your Linux system with confidence.

Why Files Are Hidden In Linux

Linux hides files to protect important configuration data from accidental modification. When you install a program, it often creates a hidden directory in your home folder to store settings. For example, the .bashrc file controls your shell environment, while .ssh holds your secure shell keys.

These files are not secret or encrypted—they’re simply not shown by default. The naming convention is simple: any file or directory starting with a dot (.) is considered hidden. This system keeps your home directory clean and prevents new users from accidentally breaking critical configurations.

Common Examples Of Hidden Files

  • .bashrc – Shell configuration for Bash
  • .profile – Login shell settings
  • .gitconfig – Git version control preferences
  • .ssh – SSH keys and configuration
  • .config – Application-specific settings
  • .local – User-installed software data

Knowing how to show hidden files linux helps you troubleshoot issues, customize your environment, and manage backups more effectively.

How To Show Hidden Files Linux Using The Terminal

The command line is the most powerful way to view hidden files. Here are the essential commands you need to know.

Using The Ls Command With The -A Flag

The ls command lists directory contents. Adding the -a flag shows all files, including hidden ones.

  1. Open a terminal window.
  2. Type ls -a and press Enter.
  3. You’ll see files starting with a dot, such as .bashrc and .profile.

For a more detailed view, combine flags: ls -la shows hidden files with permissions, sizes, and modification dates.

Using The -A Flag To Exclude Parent Directories

The -A flag works like -a but excludes the current (.) and parent (..) directory entries. This keeps your output cleaner.

Example: ls -A displays all hidden files without the extra clutter.

Listing Hidden Files Recursively

To see hidden files in subdirectories, use the -R flag: ls -aR. This shows every hidden file within the current directory and all its children.

For a tree-like view, install the tree command: tree -a displays all files, including hidden ones, in a hierarchical format.

How To Show Hidden Files Linux In File Managers

If you prefer a graphical interface, most Linux file managers have a simple toggle for hidden files.

Nautilus (GNOME Files)

  1. Open the Files application.
  2. Press Ctrl + H to toggle hidden files on or off.
  3. Alternatively, click the hamburger menu (three lines) and select “Show Hidden Files.”

Dolphin (KDE)

  1. Open Dolphin file manager.
  2. Press Alt + . (period) to toggle hidden files.
  3. You can also go to View > Show Hidden Files from the menu.

Thunar (XFCE)

  1. Open Thunar.
  2. Press Ctrl + H to show or hide dotfiles.
  3. Or navigate to View > Show Hidden Files.

Nemo (Cinnamon)

  1. Open Nemo.
  2. Press Ctrl + H to toggle visibility.
  3. You can also click the View menu and check “Show Hidden Files.”

These shortcuts work across most Linux distributions, making it easy to access hidden files without memorizing commands.

How To Show Hidden Files Linux Permanently

If you always want to see hidden files in your file manager, you can change the default settings.

Making Hidden Files Visible In Nautilus

  1. Open Nautilus and go to Edit > Preferences (or the menu icon > Preferences).
  2. Click the “Views” tab.
  3. Check the box next to “Show Hidden Files.”
  4. Close the window. Hidden files will now appear by default.

Setting A Permanent Alias In The Terminal

Create an alias to always show hidden files when you use ls.

  1. Open your .bashrc file: nano ~/.bashrc
  2. Add this line: alias ls='ls -a'
  3. Save and exit (Ctrl+X, then Y, then Enter).
  4. Reload the file: source ~/.bashrc

Now every time you type ls, hidden files will be included. You can customize this further with other flags like -l for detailed output.

How To Show Hidden Files Linux Using Find Command

The find command is excellent for locating hidden files across your entire system.

Finding All Hidden Files In Your Home Directory

Run this command to list every hidden file and folder in your home directory:

find ~ -name ".*" -maxdepth 1

The -maxdepth 1 flag limits the search to the top level only. Remove it to search recursively.

Searching For Specific Hidden Files

To find all hidden configuration files ending with .conf:

find / -type f -name ".*.conf" 2>/dev/null

The 2>/dev/null part suppresses permission errors, making the output cleaner.

How To Show Hidden Files Linux Using Grep

Combine ls with grep to filter only hidden files from a directory listing.

Example: ls -a | grep "^\."

This pipes the output of ls -a into grep, which matches lines starting with a dot. The caret (^) anchors the pattern to the beginning of each line.

For a count of hidden files: ls -a | grep -c "^\."

How To Show Hidden Files Linux With Wildcards

You can use wildcards to list only hidden files without showing regular files.

Using Echo With A Dot Pattern

echo .* lists all files and directories starting with a dot in the current directory. This is a quick trick but may include . and .. entries.

Using Ls With A Dot Pattern

ls -d .* shows only hidden items, excluding non-hidden files. The -d flag prevents listing directory contents.

How To Show Hidden Files Linux In Different Directories

You can apply the same commands to any location on your system.

Viewing Hidden Files In /Etc

System configuration files in /etc are rarely hidden, but some applications store dotfiles there. Use ls -a /etc to check.

Viewing Hidden Files In /Var

Log files and application data in /var may include hidden directories. Run ls -a /var to see them.

Viewing Hidden Files In External Drives

Mount an external drive and navigate to it. Use ls -a /mnt/usb or the file manager shortcut to reveal hidden files on the drive.

How To Show Hidden Files Linux For Backup Purposes

When backing up your system, it’s crucial to include hidden files. They contain your personalized settings and application data.

Using Rsync With Hidden Files

The rsync command can include hidden files by default. For example:

rsync -av ~/ /backup/location/

The -a (archive) flag preserves permissions and includes hidden files. Add --exclude to skip certain patterns if needed.

Using Tar To Archive Hidden Files

Create a tar archive that includes dotfiles:

tar -czf backup.tar.gz ~/.* ~/*

This command archives both hidden and regular files in your home directory.

Common Mistakes When Showing Hidden Files

Here are a few pitfalls to avoid.

Accidentally Deleting Important Files

Hidden files are often critical. Deleting .bashrc or .ssh can break your system or lock you out of remote servers. Always double-check before removing dotfiles.

Confusing Hidden With Encrypted

Hidden files are not encrypted. Anyone with access to your system can view them using the commands above. For sensitive data, use encryption tools like gpg.

Forgetting To Toggle Back

If you permanently enable hidden files in your file manager, you might accidentally modify configuration files. Toggle them off when you’re done to avoid clutter.

How To Show Hidden Files Linux On Different Distributions

The methods described work on all major Linux distributions, including Ubuntu, Fedora, Debian, Arch Linux, and openSUSE. The commands are standard across the Linux ecosystem.

However, file manager shortcuts may vary slightly. For example, some lightweight window managers like i3 or Openbox require you to use terminal commands exclusively.

How To Show Hidden Files Linux Using Scripts

Automate the process with a simple shell script.

  1. Create a new file: nano show_hidden.sh
  2. Add the following code:

#!/bin/bash
echo "Hidden files in current directory:"
ls -a | grep "^\."

  1. Save and make it executable: chmod +x show_hidden.sh
  2. Run it: ./show_hidden.sh

You can expand this script to search recursively or output to a file.

How To Show Hidden Files Linux For Troubleshooting

When an application misbehaves, its hidden configuration files are often the culprit. For example, if your desktop environment crashes, check .xsession-errors in your home directory.

To view this hidden log file: cat ~/.xsession-errors or less ~/.xsession-errors.

Similarly, browser issues can be traced to hidden directories like .mozilla or .config/google-chrome.

Frequently Asked Questions

What Is The Shortcut To Show Hidden Files In Linux?

In most file managers, press Ctrl + H to toggle hidden files on and off. In the terminal, use ls -a.

How Do I Show Hidden Files In Linux Without Using Terminal?

Open your file manager (Nautilus, Dolphin, Thunar) and press Ctrl + H or check “Show Hidden Files” in the View menu.

Can I Make Hidden Files Always Visible In Linux?

Yes. In Nautilus, go to Preferences > Views and check “Show Hidden Files.” In the terminal, add an alias to your .bashrc file.

Why Are Some Files Hidden In Linux?

Files starting with a dot are hidden by convention to reduce clutter and protect configuration data from accidental modification.

How Do I Hide A File In Linux?

Rename the file to start with a dot: mv filename .filename. It will then be hidden from default listings.

Final Tips For Managing Hidden Files

Now that you know how to show hidden files linux, use this knowledge responsibly. Always back up important dotfiles before editing them. Create a version control repository for your configuration files using Git—it’s a common practice among Linux users.

Remember that hidden files are not a security feature. They’re simply a way to organize your system. If you need to protect sensitive information, use proper encryption methods.

Practice the commands in a test directory first. Create a hidden file with touch .testfile and verify it appears when you use ls -a. This hands-on approach will solidify your understanding.

With these techniques, you can fully explore your Linux system, customize your environment, and troubleshoot issues like a pro. The ability to access hidden files is a fundamental skill that opens up deeper control over your operating system.