~/linux-guide.sh
0 / 0 done
FINAL IN 2 WEEKS
// Linux — Learning by Doing

Open a terminal.
Follow along. Actually do it.

This isn't a list of commands to memorize. Each section is a real task you'll complete, so by the end you'll have actually used every command — not just read about it.

Open a Linux terminal next to this page and work through it top to bottom
🧭
CHAPTER 01
Finding Your Way Around
Linux is a filesystem full of folders and files. Before you can do anything else, you need to know how to look around and move between places. These three commands are the ones you'll use constantly.
// What you'll do
Figure out where you are, look at what's around you, move into folders, and get back home. These are your survival commands — you'll use them every single time you open a terminal.
STEP 1
Find out where you are right now

Before you can go anywhere, you need to know where you already are. Type this:

Type this in your terminal
$pwd
// You'll see something like this
/home/jayden
// What just happened
pwd stands for "print working directory." It printed the full path to where you're sitting right now. The / at the start means you're starting from the very top of the filesystem. /home/jayden means: inside the home folder, inside a folder with your username. That's your home base.
STEP 2
See what's in your current folder

Now look at what's inside the folder you're in:

Type this
$ls
// You'll see something like this
Desktop Documents Downloads Music Pictures
// What just happened
ls listed everything in your current folder. Now try the more detailed version — it shows extra info like permissions and file sizes:
Now try this
$ls -l
// You'll see something like this
drwxr-xr-x 2 jayden jayden 4096 Apr 20 09:00 Desktop drwxr-xr-x 3 jayden jayden 4096 Apr 19 14:30 Documents
// What the extra info means
That long string of letters and dashes on the left? Those are permissions — who's allowed to read, write, or run this file. You'll learn exactly what that means in Chapter 4. The name after that is the owner. For now, just notice that it exists.
STEP 3
Move into a folder and back out

Now actually go somewhere. Move into your Documents folder (or whatever showed up in your ls):

Move into Documents
$cd Documents
$pwd
// Your pwd now shows the new location
/home/jayden/Documents
// You moved!
Notice how pwd now shows a longer path — you went deeper into the filesystem. Now go back up one level:
Go back up one level
$cd ..
$pwd
// The dots trick
.. always means "the folder above where I am." If you ever feel completely lost, just type cd with nothing after it — that always takes you back to your home folder no matter where you are.
// Lost? Run this sequence any time
cd → go home  ·  pwd → confirm where you are  ·  ls → see what's here
Chapter 1 complete when you can:
  • Type pwd and know what the output means
  • Type ls -l and read the file list
  • Use cd folder, cd .., and cd to move around confidently
📁
CHAPTER 02
Creating and Managing Files
You're going to build a real practice workspace from scratch, then move things around, copy them, and delete them. By the end of this chapter you'll have a folder full of files you made yourself.
// What you'll build
A folder called linuxlab inside your home directory, with several files in it. You'll use this same folder for the rest of the guide, so don't delete it yet.
STEP 1
Create your practice workspace

First, make sure you're home. Then create a new folder:

Create the folder
$cd # go home first
$mkdir linuxlab
$ls
// You should now see linuxlab in the list
Desktop Documents Downloads linuxlab Music
// What just happened
mkdir (make directory) created a new empty folder. Now move into it:
Move into your new folder
$cd linuxlab
$pwd
// Confirms you're inside your folder
/home/jayden/linuxlab
STEP 2
Create some files to work with

Create several blank files at once:

Create files with touch
$touch notes.txt log.txt readme.txt
$ls
// Three files just appeared
log.txt notes.txt readme.txt
// What just happened
touch creates empty files. Nothing is in them yet — they're blank. You can create multiple files by listing them with spaces in between.
STEP 3
Copy, rename, and delete

Now practice the three most important file operations:

Copy a file
$cp notes.txt notes_backup.txt
$ls
// cp = copy. Original stays, copy appears
cp notes.txt notes_backup.txt means: copy this file and save the copy as this name.
Rename a file with mv
$mv log.txt old_log.txt
$ls
// mv = move, but it's also how you rename
"Moving" a file to the same folder with a different name is how you rename in Linux. mv also works for moving files to different folders, like mv file.txt /tmp/.
Delete a file
$rm old_log.txt
$ls
rm does not ask "are you sure." The file is immediately gone. There's no recycle bin. Be careful — this is one of the most common ways beginners lose their work.
Chapter 2 complete when you can:
  • Create a folder with mkdir and files with touch
  • Copy files with cp and understand the original stays
  • Rename or move files with mv
  • Delete files with rm — and remember it doesn't ask for confirmation
🔍
CHAPTER 03
Reading and Searching Files
Linux uses text files everywhere — settings, logs, user lists. You need to be able to read them, scroll through big ones, and search for specific text inside them. Let's use your linuxlab files from the last chapter.
// What you'll do
You'll put real content into a file, then read it different ways, search inside it, and count things in it. This is exactly what your labs will ask you to do.
STEP 1
Put content into a file

First, make sure you're in your linuxlab folder. Then write some text into notes.txt:

Write text into a file using echo
$cd ~/linuxlab
$echo "Linux is an operating system" > notes.txt
$echo "The kernel talks to the hardware" >> notes.txt
$echo "Users and permissions control access" >> notes.txt
$echo "grep searches inside files" >> notes.txt
$echo "find locates files on the system" >> notes.txt
// What > and >> do
> sends output into a file, overwriting anything that was there. >> appends to the end without erasing. That's why we use > for the first line and >> for every line after — otherwise we'd keep overwriting what we just wrote.
STEP 2
Read the file three different ways
cat — show the whole file at once
$cat notes.txt
// All 5 lines printed to screen
Linux is an operating system The kernel talks to the hardware Users and permissions control access grep searches inside files find locates files on the system
// cat vs less
cat dumps everything at once — fine for small files. If the file is huge, everything scrolls past too fast to read. That's when you use less:
less — scrollable viewer
$less notes.txt
// Controls inside less
Arrow keys = scroll  ·  q = quit  ·  /word = search for a word  ·  n = jump to next match
head / tail — see just the start or end
$head notes.txt # first 10 lines
$tail notes.txt # last 10 lines
STEP 3
Search inside the file with grep

grep finds lines that contain a word or phrase. This is one of the most-used commands in all of Linux.

Search for a word
$grep kernel notes.txt
// Only shows lines containing "kernel"
The kernel talks to the hardware
// grep only prints matching lines
It went through the whole file but only printed the line with "kernel" in it. Now try counting matches instead of showing them:
Count matches with -c
$grep -c files notes.txt
// Prints the count, not the lines
2
// When to use -c
Your labs often ask you to count something — like "how many lines in /etc/passwd mention bash?" That's exactly grep -c bash /etc/passwd.
STEP 4
Count lines, words, and characters with wc
Word count your file
$wc notes.txt # lines, words, bytes
$wc -l notes.txt # lines only
$wc -w notes.txt # words only
// wc output: lines words bytes filename
5 22 153 notes.txt 5 notes.txt 22 notes.txt
// wc = word count, but it counts more than words
Labs often ask "how many lines does this file have?" — that's wc -l filename. You'll also combine this with other commands using pipes (Chapter 7).
Chapter 3 complete when you can:
  • Use echo "text" > file to write into a file and >> to add more
  • Choose between cat, less, head, tail depending on what you need
  • Search inside a file with grep word file and count matches with -c
  • Count lines in a file with wc -l file
🔒
CHAPTER 04
Permissions
Every file in Linux has rules about who can read it, change it, or run it. This is one of the most exam-heavy topics, so don't skip it. Once you understand the pattern, it clicks fast.
// What you'll do
Look at the permissions on your files, understand what the letters mean, change permissions using numbers, and verify the change actually worked.
STEP 1
Look at the permissions on your files
Run ls -l in your linuxlab folder
$cd ~/linuxlab
$ls -l
// You'll see a line like this for each file
-rw-r--r-- 1 jayden jayden 153 Apr 22 10:00 notes.txt
// Breaking down -rw-r--r--
That string of characters is the permission block. Here's exactly what each part means:
-
r
w
-
r
-
-
r
-
-
type
own
own
own
grp
grp
grp
oth
oth
oth
Reading it: file type · owner (you) · group · everyone else
r
w
-
= 4+2+0 = 6  (owner: read + write)
r
-
-
= 4+0+0 = 4  (group: read only)
r
-
-
= 4+0+0 = 4  (others: read only)
So -rw-r--r-- = 644 in numbers
// The three permission bits
r = 4 (read)  ·  w = 2 (write)  ·  x = 1 (execute)  ·  - = 0 (nothing).
Add them up for each group: owner, group, others.
STEP 2
Change the permissions and see it happen

Now actually change the permissions using a number, then check that it worked:

Lock the file down so only you can use it
$chmod 600 notes.txt
$ls -l notes.txt
// Permissions changed to rw-------
-rw------- 1 jayden jayden 153 Apr 22 10:00 notes.txt
// What 600 means
6 = rw for owner  ·  0 = nothing for group  ·  0 = nothing for others. Only you can read or write this file. Now change it back to normal:
Set back to a normal file permission
$chmod 644 notes.txt
$ls -l notes.txt
// Common numbers to remember
644 = normal file (you rw, others read)  ·  755 = executable/folder  ·  600 = private  ·  777 = everyone everything (dangerous)
STEP 3
Get full file details with stat
stat shows everything about a file
$stat notes.txt
// stat gives you permissions in BOTH formats
File: notes.txt Size: 153 Blocks: 8 IO Block: 4096 regular file Device: 802h Inode: 524289 Links: 1 Access: (0644/-rw-r--r--) Uid: (1000/jayden) Gid: (1000/jayden)
// Why stat is useful in labs
Labs often ask you to show permission info. stat shows it in both formats — the number (0644) and the letters (-rw-r--r--) — so it's a good command to run when a question asks you to "show file details."
Chapter 4 complete when you can:
  • Read the permission string from ls -l and identify owner, group, others
  • Calculate what a number like 644 or 755 means in rwx letters
  • Change permissions with chmod using numbers
  • Use stat to get full file details including both permission formats
👤
CHAPTER 05
Users, Groups, and sudo
Linux is built so that different users have different levels of access. Understanding who you are and how to get admin powers when you need them is essential for any lab.
STEP 1
Find out who you are
Check your identity
$whoami # just your username
$id # full user and group IDs
$groups # just your group names
// What each command returns
jayden uid=1000(jayden) gid=1000(jayden) groups=1000(jayden),27(sudo) jayden sudo
// What UID and GID mean
Every user has a UID (User ID number) and a GID (Group ID). The system uses these numbers internally. Regular users start at 1000. Root is always UID 0 — that's the admin account.
STEP 2
Use sudo to run commands with admin power

Some commands need admin (root) access. Instead of logging in as root, you use sudo in front of the command:

Create a user (needs admin)
$sudo useradd testuser # it'll ask for your password
$getent passwd testuser # confirm user exists
// getent confirms the user was created
testuser:x:1001:1001::/home/testuser:/bin/sh
// sudo vs logging in as root
sudo lets you run one command with admin power, then immediately drops back to your regular account. This is safer than staying logged in as root, where one typo can break the whole system.
// Clean up after yourself
If you want to remove the test user after: sudo userdel testuser
Chapter 5 complete when you can:
  • Use whoami, id, and groups and explain what each shows
  • Explain the difference between a regular user, root, and using sudo
  • Create a user with sudo useradd and confirm with getent passwd
⚙️
CHAPTER 06
Processes
Every running program is a process. Each one has an ID number. Labs often ask you to show processes, find your shell's ID, and count how many are running.
STEP 1
See what processes are running
List processes
$ps # your processes only
$ps -ef | head -15 # all processes, first 15 lines
// ps output shows PID, terminal, time, command
PID TTY TIME CMD 1234 pts/0 00:00:00 bash 5678 pts/0 00:00:00 ps
// PID and PPID
PID = Process ID (a unique number for each running program). PPID = Parent Process ID (the process that started this one). When you open bash, it starts with a PID. Any command you run from bash has bash's PID as its PPID.
STEP 2
Find your own shell's PID and its parent
Show your shell PID and parent
$echo $$ # $$ = your shell's PID
$ps -p $$ -o pid,ppid,cmd # show PID, PPID, and command name
// Shows your bash's PID and what started it
1234 PID PPID CMD 1234 1100 bash
// $$ is a special variable
In bash, $$ automatically holds your current shell's PID. You'll use this in labs that ask you to "show your bash PID and its parent process."
Count total running processes
$ps -e | wc -l
// This is a pipe — you'll learn why it works in Chapter 7
ps -e lists all processes. The | sends that output to wc -l, which counts the lines. Result = total number of processes running.
Chapter 6 complete when you can:
  • Explain what a PID and PPID are in plain English
  • Use ps and ps -ef to see running processes
  • Use echo $$ and ps -p $$ to find your shell's PID and parent
🔗
CHAPTER 07
Pipes and Redirection
The real power of Linux is chaining commands together. A pipe sends the output of one command directly into another. This is how you do things like "find all users and count them" in a single line.
STEP 1
Chain two commands with a pipe

The | symbol (pipe) sends one command's output directly into another. Think of it as "take the result of this, and feed it into that."

Extract usernames from /etc/passwd and count them
$cut -d: -f1 /etc/passwd # get usernames from system file
$cut -d: -f1 /etc/passwd | sort # pipe into sort
$cut -d: -f1 /etc/passwd | sort | wc -l # pipe again, count lines
// Last command gives a total count
root daemon ...more names... 32
// How the pipeline works step by step
1. cut -d: -f1 /etc/passwd — reads the file, splits by colon (-d:), takes field 1 (-f1) = just usernames

2. | sort — takes those names and alphabetically sorts them

3. | wc -l — counts how many lines = total number of users

This is a pipeline — three commands connected, each doing its part.
STEP 2
Save output to a file with > and >>
Redirect output into a file
$cd ~/linuxlab
$date > report.txt # write date to new file
$ls -l >> report.txt # append the file listing
$cat report.txt # see the combined result
// report.txt contains both the date AND the file listing
Wed Apr 22 10:32:00 EDT 2026 total 16 -rw-r--r-- 1 jayden jayden 153 Apr 22 notes.txt ...
// The critical difference
> overwrites. If you use it twice on the same file, you lose what was there. >> adds to the end. Use > to start fresh, >> to keep adding.
STEP 3
Use find to locate files
Find files by name and by modification time
$find ~/linuxlab -type f # all files in linuxlab
$find ~ -type f -mtime -1 # files touched in the last day
$find ~ -type f | wc -l # count all files in home dir
// grep vs find — know the difference for the exam
grep = search inside a file for text   ·   find = search for a file by name, date, or size
Chapter 7 complete when you can:
  • Use | to connect commands and explain what it does
  • Use > vs >> and know which one overwrites
  • Build a 3-command pipeline and trace what each step does
  • Use find to search for files and grep to search inside files
📦
CHAPTER 08
Archives and Compression
Bundle multiple files into one archive, compress it to save space, and verify what's inside without unpacking. Labs often ask you to create an archive and compare sizes.
STEP 1
Archive and compress your linuxlab folder
Create a compressed archive
$cd ~
$tar -czvf linuxlab_backup.tar.gz linuxlab
$ls -lh linuxlab_backup.tar.gz # size of the archive
$du -sh linuxlab # size of the original folder
// tar prints each file it adds, then you see sizes
linuxlab/ linuxlab/notes.txt linuxlab/notes_backup.txt linuxlab/readme.txt linuxlab/report.txt 4.0K linuxlab_backup.tar.gz 12K linuxlab
// The tar flags: c z v f
c = create  ·  z = compress with gzip  ·  v = verbose (show progress)  ·  f = the filename comes next

The archive file (.tar.gz) is smaller than the original because of compression — that's what the z flag does.
STEP 2
List the contents without unpacking
Peek inside the archive (t = list)
$tar -tzf linuxlab_backup.tar.gz
// Lists contents without extracting anything
linuxlab/ linuxlab/notes.txt linuxlab/notes_backup.txt linuxlab/readme.txt
// t vs c vs x
Change one letter, completely different behavior: c = create  ·  t = list  ·  x = extract. Always remember to keep z and f when working with .tar.gz files.
Chapter 8 complete when you can:
  • Create a compressed archive with tar -czvf and explain each flag
  • List archive contents with tar -tzf without extracting
  • Compare archive size vs original folder size with ls -lh and du -sh
CHAPTER 09
Getting Help When You Forget
You will forget commands. That's expected and normal. The important thing is knowing where to look. These tools are always available in your terminal — use them.
STEP 1
Three levels of help for any command

Try all three on the same command — chmod — and feel the difference:

whatis — fastest, one line
$whatis chmod
// One-line summary
chmod (1) - change file mode bits
which — where does this command live?
$which chmod
// Shows the path to the program file
/usr/bin/chmod
man — full manual (press q to quit)
$man chmod
// When to use each one
whatis = "I just need a quick reminder what this does"  ·  which = "where is this program installed?"  ·  man = "I need to actually learn this command or look up a specific flag"
// Inside man pages
Arrow keys to scroll  ·  q to quit  ·  /word to search  ·  n to jump to next match
Chapter 9 complete when you can:
  • Use whatis, which, and man and know when each is useful
  • Navigate a man page and search for a specific word inside it

You just did Linux.

You didn't read about it. You built a workspace, added files, changed permissions, searched for things, chained commands, archived everything, and found your way around — all by actually doing it in a real terminal.

You can navigate the filesystem without getting lost
You can create, copy, move, and delete files
You can read, search, and count text in files
You can read and change permissions
You understand users, root, and sudo
You can chain commands with pipes and redirection
You can archive and compress folders
You know how to get help when you forget something

Go through it a second time. It gets faster. That's how this sticks.