# The Linux File Tree

> How Linux folders hang from one root, written as a slash. How to move around with pwd, cd and ls, and why some files are hidden.

**Course:** [Linux Command Line](https://learn.benibix.com/learn/infrastructure-linux)  
**Time:** 12 min

**After this lesson you can:**

- Read a file path from the root down
- Move between folders with cd
- List hidden files with ls -a

## How to find your way around the folders

On Linux, every file sits in one tree of folders that starts at the top folder, written as a single slash: /. There are no drive letters like C:. Your own folder is /home and your name, such as /home/emma, and the sign ~ is short for it. Three commands move you around: pwd, cd and ls.

A few folders under / are worth knowing. /etc holds settings. /var/log holds logs. /home holds each user's own folder. /root is the home of the root user, which is not the same as the top folder. /tmp holds files that are cleared out on a restart.

A file path is the list of folders down to a file, joined by slashes. /var/log/syslog starts at the top, so it means the same thing wherever you are. A path that does not start with a slash is read from the folder you are in now.

pwd prints the folder you are in. cd moves you to another one. cd /var/log goes straight there. cd .. goes up one level. cd on its own takes you home. ls lists what is in a folder, and ls -l adds the size, owner and date of each file.

A file whose name starts with a dot is hidden. ls does not show it, so a folder can look empty and still hold files. ls -a shows them. Settings live in hidden files, such as .bashrc, and keys for logging in to other machines live in a hidden folder called .ssh.

The two dots in cd .. are a real name, not a trick. Every folder holds two hidden entries: one dot for itself and two dots for the folder above. That is why ls -a always shows them first.

A common mistake is to run a command in the wrong folder. Delete commands act on the folder you are in. Before you change or delete anything, type pwd and check where you are. It costs one second and saves the wrong files.

```console
$ pwd
/home/emma
$ cd /var/log
$ cd ..
$ pwd
/var
$ ls -a ~
.  ..  .bashrc  .ssh  notes.txt
```
Where am I, move, go up one, check again, then list your home folder with the hidden files.

![A folder tree with a single slash at the top, the root. Below it hang etc, home, root and var. Under home sits emma, marked with a tilde as her home folder and with a you-are-here marker. Inside emma are notes.txt, photos and two faded hidden items, .bashrc and .ssh. Under var sits log. An arrow shows a cd move from emma down to var/log.](https://learn.benibix.com/diagrams/inf3-file-tree.svg)

### Example: Emma looks for a server's settings

Emma logs in to a new server and lands in /home/emma. She needs the settings for its web program.

She types cd /etc/nginx and ls, and sees the file nginx.conf. Back home with cd, ls -a shows the .ssh folder she was told to look for.

**Words in this lesson:** [Root Directory (/)](https://learn.benibix.com/term/infrastructure/root-directory), [Home Directory (~)](https://learn.benibix.com/term/infrastructure/home-directory), [File Path](https://learn.benibix.com/term/development/file-path), [pwd](https://learn.benibix.com/term/infrastructure/pwd-command), [cd](https://learn.benibix.com/term/infrastructure/cd-command), [ls](https://learn.benibix.com/term/infrastructure/ls-command), [Hidden File (Dotfile)](https://learn.benibix.com/term/infrastructure/hidden-file)

**Question:** A folder looks empty with ls, but you were told a .ssh folder is in it. What do you type?

**Answer:** ls -a. Names that start with a dot are hidden from a plain ls. The -a option shows all of them, hidden ones included.

---

Source: https://learn.benibix.com/learn/infrastructure-linux/linux-file-tree
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
