04. The Linux File System pwd, ls, cd

What is a File System?

Computers organize their files using a tree-like structure known as a file system.

Linux has a single file tree system, which starts with the root directory (/). On a Windows, the "root" would be something like C:\.

The following image shows what a Linux File System would look like.

UNIX file structure
The Linux file system

Everything in Linux is a file

In Linux, almost everything is represented as a file (or directory) on the File System. This includes USB devices and hard disks, which are stored under /dev.

Naming files

A filename can contain uppercase or lowercase letters, numbers and most punctuation characters. Note that filenames are case sensitive!

Special characters

Some files begin with a dot (.) and are used for configuration settings. Others can end with a tilden (~), denoting that it is a backup file. Furthermore, we'll see how we can use ? and * to denote special cases when we learn about wildcards and globbing. Although you can name your files with these symbols, it's highly not recommended.

Checking your Current Directory

You can check to see where you are along this file system with the pwd command (short for "print working directory").

$ pwd
/home/JohnDoe/Dropbox/FunStuff

Here, we can see that we are in our FunStuff directory, which is within our Dropbox folder.

Take your Linux skills to the next level!

The Linux Command Line

Take your Linux skills to the next level! Try Linux & UNIX

The Linux Command Line takes you from your very first terminal keystrokes to writing full programs in Bash, the most popular Linux shell. Along the way you'll learn the timeless skills handed down by generations of gray-bearded, mouse-shunning gurus: file navigation, environment configuration, command chaining, pattern matching with regular expressions, and more.

$ Check price
39.9539.95Amazon 4.5 logo(274+ reviews)

More Linux & UNIX resources

Aching back from coding all day?

Inversion Therapy Table

Aching back from coding all day? Try Back Problems

Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.

$$ Check price
119.98119.98Amazon 4.5 logo(1,700+ reviews)

More Back Problems resources

Ad