In Linux, a hidden file or directory is any name that starts with a dot
(.). Examples include .bashrc, .ssh, .config, and .cache.
Hidden files are not protected by the dot in their name; the dot only
keeps them out of normal ls output.
This guide shows how to:
- show hidden files with
ls - list only hidden files and directories
- find hidden files recursively with the find command
- check hidden file and hidden folder size with
duwhen you are checking disk space - understand why
du -sh *does not include hidden files
The commands below were tested in a temporary directory:
$ find /tmp/show-hidden-demo -maxdepth 3 -printf '%P\n' | sort
..double_hidden
.hidden_dir
.hidden_dir/.secret.conf
.hidden_dir/cache.txt
.hidden_dir/nested
.hidden_dir/nested/blob.bin
.hidden_file
visible_dir
visible_file
Why normal ls does not show hidden files
Run ls -l and only normal entries are listed:
$ ls -l
total 0
drwxrwxr-x 2 golinuxcloud golinuxcloud 40 Jun 7 12:44 visible_dir
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 visible_file
The hidden entries exist in the same directory, but ls hides names
that start with . unless you use an option such as -a or -A.
Show hidden files with ls -la
Use ls -la to show all files, including hidden files:
$ ls -la
total 0
drwxrwxr-x 4 golinuxcloud golinuxcloud 140 Jun 7 12:44 .
drwxrwxrwt 21 nobody nogroup 520 Jun 7 12:44 ..
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 ..double_hidden
drwxrwxr-x 3 golinuxcloud golinuxcloud 100 Jun 7 12:44 .hidden_dir
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 .hidden_file
drwxrwxr-x 2 golinuxcloud golinuxcloud 40 Jun 7 12:44 visible_dir
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 visible_file
Options used:
-l: use long listing format-a: show all entries, including.and..
The entries . and .. are special directory entries:
.means the current directory..means the parent directory
Show hidden files with ls -lA
Use ls -lA when you want hidden files but do not want to show . and
..:
$ ls -lA
total 0
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 ..double_hidden
drwxrwxr-x 3 golinuxcloud golinuxcloud 100 Jun 7 12:44 .hidden_dir
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 .hidden_file
drwxrwxr-x 2 golinuxcloud golinuxcloud 40 Jun 7 12:44 visible_dir
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 visible_file
Options used:
-A: show almost all entries, excluding.and..
For most command-line checks, ls -lA is cleaner than ls -la.
List only hidden files and directories
If you want to list only hidden entries in the current directory, use a safe shell glob:
$ ls -ld .[!.]* ..?* 2>/dev/null
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 ..double_hidden
drwxrwxr-x 3 golinuxcloud golinuxcloud 100 Jun 7 12:44 .hidden_dir
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 .hidden_file
This pattern is safer than .?*:
.[!.]*matches names such as.hidden_fileand.hidden_dir..?*matches names such as..double_hidden2>/dev/nullhides unmatched-pattern errors
Avoid using only .?* because it can match .., which is the parent
directory.
If you need the command to exit cleanly in Bash when one pattern has no
match, enable nullglob first:
$ shopt -s nullglob
Find hidden files recursively
Use find when you need to search below the current directory:
$ find . -type f -name '.*' -print
./..double_hidden
./.hidden_file
./.hidden_dir/.secret.conf
Options used:
-type f: match files only-name '.*': match names that start with.-print: print the matched path
This finds hidden files in the current directory and in hidden or normal subdirectories below it.
Find hidden directories recursively
Use -type d to find hidden directories:
$ find . -type d -name '.*' ! -name . ! -name .. -print
./.hidden_dir
The ! -name . ! -name .. filters exclude the current and parent
directory entries.
Check size of hidden files with ls
You can combine find and ls -lh to view the apparent size of hidden
files:
$ find . -type f -name '.*' -exec ls -lh {} +
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 ./..double_hidden
-rw-rw-r-- 1 golinuxcloud golinuxcloud 14 Jun 7 12:44 ./.hidden_dir/.secret.conf
-rw-rw-r-- 1 golinuxcloud golinuxcloud 0 Jun 7 12:44 ./.hidden_file
Use ls when you want file metadata such as permissions, owner, and
apparent file size.
Check size of hidden files with du
Use du when you want disk usage:
$ find . -type f -name '.*' -exec du -h {} +
0 ./..double_hidden
0 ./.hidden_file
4.0K ./.hidden_dir/.secret.conf
Use du -hs with the safe hidden-file glob to summarize hidden entries
in the current directory:
$ du -hs .[!.]* ..?* 2>/dev/null
24K .hidden_dir
0 .hidden_file
0 ..double_hidden
Options used:
-h: show human-readable sizes-s: summarize each argument
Find largest hidden files and directories
To find the largest hidden items recursively, combine du, sort, and
head:
$ du -ah .[!.]* ..?* 2>/dev/null | sort -hr | head
24K .hidden_dir
16K .hidden_dir/nested/blob.bin
16K .hidden_dir/nested
4.0K .hidden_dir/cache.txt
4.0K .hidden_dir/.secret.conf
0 .hidden_file
0 ..double_hidden
Options used:
du -a: include files and directoriessort -h: sort human-readable sizes correctlysort -r: largest firsthead: show the first lines only
Why du -sh * does not include hidden files
In Bash and most POSIX-style shells, * does not expand to names that
start with a dot. That means this command checks only non-hidden entries
in the current directory:
$ du -sh *
4.0K visible_dir
0 visible_file
To include both normal and hidden entries, pass both patterns:
$ du -hs * .[!.]* ..?* 2>/dev/null
4.0K visible_dir
0 visible_file
24K .hidden_dir
0 .hidden_file
0 ..double_hidden
Show hidden files in Ubuntu file manager
In Ubuntu's Files app and many Linux desktop file managers, press
Ctrl+H to toggle hidden files. You can also use the file manager menu
and enable the option to show hidden files.
This only changes the desktop view. It does not change file permissions
or make the files visible to normal ls output in a terminal.
If you want to inspect files below many nested directories, also see the guide on how to list recursively with ls.
Create hidden files and directories
To create a hidden file, start the filename with a dot:
$ touch .my_hidden_file
To create a hidden directory, start the directory name with a dot:
$ mkdir .my_hidden_directory
To make an existing file hidden, rename it so the new name starts with a dot:
$ mv normal_file .normal_file
FAQ
What command shows hidden files in Linux?
Use ls -la to show hidden files with . and .., or use ls -lA to
show hidden files without . and ...
How do I list only hidden files in Linux?
Use:
$ ls -ld .[!.]* ..?* 2>/dev/null
This lists only hidden entries in the current directory and avoids accidentally listing the parent directory.
How do I find hidden files in Linux?
Use:
$ find . -type f -name '.*' -print
Replace . with another path when you want to search somewhere else.
Does ls -a show hidden folders too?
Yes. ls -a shows hidden files and hidden directories because both are
identified by a leading dot in the name.
What is the difference between ls -a and ls -A?
ls -a shows all entries, including . and ... ls -A shows hidden
entries too, but excludes . and ...
How do I check hidden folder size in Linux?
Use du -hs:
$ du -hs .[!.]* ..?* 2>/dev/null
For largest hidden files and folders, use:
$ du -ah .[!.]* ..?* 2>/dev/null | sort -hr | head
Are hidden files secure?
No. A leading dot only hides the file from normal listings. Use Linux permissions, encryption, or access controls when you need security.
Summary
Use ls -la or ls -lA to show hidden files in Linux. Use
ls -ld .[!.]* ..?* 2>/dev/null when you want only hidden entries in
the current directory. Use find . -type f -name '.*' -print to find
hidden files recursively. Use du -hs .[!.]* ..?* 2>/dev/null to check
the disk usage of hidden files and hidden directories.

