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!

Linux for Beginners

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

Linux for Beginners doesn't make any assumptions about your background or knowledge of Linux. You need no prior knowledge to benefit from this book. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.

$ Check price
24.9924.99Amazon 4.5 logo(101+ reviews)

More Linux & UNIX resources

Aching back from coding all day?

Prism Glasses

Aching back from coding all day? Try Back Problems

Ever feel achy from sitting crunched up on your computer table? Try lying down with these optical glasses that allow you to work on your laptop while lying flat on your back. This is the perfect solution with those with limited mobility or those who wish to prevent neck cramps and back strains.

$ Check price
4.454.45Amazon 4 logo(128+ reviews)

More Back Problems resources

Ad