Listing Linux Files and Hidden Names
How it works
ls lists names for inspection. By default, a name beginning with . is omitted from a directory listing; this convention is not a security feature. ls -a includes dot names and ./..; ls -A includes hidden names except those two special entries. ls -l displays a longer listing with file kind, permissions, link count, owner, group, size and a timestamp. The first character is commonly - for a regular file, d for a directory and l for a symbolic link. Permission details come later. ls -d DIRECTORY describes the directory itself instead of listing its contents.
Prepare a safe practice environment
Use GNU/Linux and Bash as a normal user. From the extracted package root run bash lab-fixtures/files/setup.sh. It prints a fresh private directory under /tmp. Copy that path and enter it with cd (quote the path if needed); check pwd. Each code example below starts in a new lab with the same fixture: notes/hello.txt, notes/daily report.txt, notes/-draft, notes/.hidden, and empty directories archive and empty. Set export LC_ALL=C for the shown ordering and English diagnostics. Never run the modifying examples on your own files.
Show ordinary names
The three ordinary names appear, including the leading-dash name and the filename containing a space.
Reveal hidden names
Adds .hidden but not . or ...
Inspect a directory itself
One long listing starts with d and ends with notes; ownership, mode and timestamp vary.
Compare the question "what is inside notes?" with "what kind of object is notes itself?". The first uses a directory listing, while the second uses -d. The long format adds metadata to whichever entries were selected; it does not make hidden names visible on its own.
Common mistakes and safe habits
Hidden does not mean private. Do not split the printed output of ls on spaces to process filenames; a single filename can contain spaces or even newlines. Use shell globbing (lesson 8) or a filename-safe search tool later. The tree utility can draw a hierarchy if installed, but is optional and not tested here.
Try it yourself
Compare ls -1 notes, ls -1a notes and ls -1A notes. Identify the extra entries and inspect archive itself.
Use a fresh lab for the practice. When finished, return to the lab root if you are in a subdirectory, then leave it with cd ... Remove only the identified temporary lab folder using your file manager if desired. Never remove an unrelated path.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Listing files and hidden names — Knowledge Check
Apply filesystem concepts in a fresh disposable Linux lab.
What makes .hidden hidden in an ordinary ls listing?
Which option reveals hidden names but omits . and ..?
Which command describes notes itself?
What does a leading d in a long listing indicate?
Why is splitting ls output on spaces unreliable?