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.

Aching back from coding all day?

Self-Massage Tool

Aching back from coding all day? Try Back Problems

Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.

$ Check price
29.9529.95Amazon 4.5 logo(3,443+ reviews)

More Back Problems resources

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

Ad