Hidden files in Linux: the leading dot

Updated November 1, 2026

A hidden file in Linux is a file whose name starts with a dot.

Common cases

ls               # hidden files are not shown
ls -a            # show everything, including dotfiles
ls -A            # everything except . and ..
cat ~/.bashrc    # a typical hidden config file

Sample output

$ ls
app.py
$ ls -a
.  ..  .env  .gitignore  app.py
$ ls -A
.env  .gitignore  app.py

How it works: there is no 'hidden' attribute

Linux has no separate 'hidden' flag like some other systems. A file is hidden purely by convention: its name starts with a dot, and a plain ls does not print those. This is how config files (.bashrc, .ssh) stay out of the way in your home directory. ls -a shows everything, including the . (the directory itself) and .. (the parent) entries; ls -A shows the dotfiles but hides those two housekeeping entries.

Common mistakes

cp -r src/* dst does not copy everything. The shell expands *, and it never substitutes names that start with a dot: src holds app.py and .env, yet after the copy ls -A dst shows only app.py. The form that takes the dotfiles along is cp -r src/. dst - after it ls -A dst prints .env app.py.

rm * leaves the dotfiles behind, and the directory then refuses to go away. After rm d/* the command ls d prints nothing, while rmdir d answers rmdir: failed to remove 'd': Directory not empty. ls -A d explains it: .env is still inside.

You can hide a file by accident. Type mv report.txt .report.txt and ls stops showing anything, as if the file were deleted. It is still there, and ls -A prints .report.txt. The dot is not a 'hide' command, it is the first character of the name, so a stray dot during a rename does exactly what a real config file does.

Used in

You need this in the lesson The filesystem and navigation. The theory is the chapter The filesystem and moving around.

See also

Absolute and relative paths, The ls command, The ~/.bashrc file.

Try it

Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.