Unix Tutorial for Beginners: Learn Unix & Linux Commands Step by Step
What Is Unix?
Unix is an operating system family that started at AT&T Bell Labs in 1969. It introduced ideas that are now everywhere: hierarchical file systems, the shell, pipes (|), text-based system configuration, and "do one thing well" command-line tools.
Unix itself isn't free or open source (the original is owned by The Open Group). But its ideas spawned a whole family of compatible systems: Linux, FreeBSD, OpenBSD, macOS, Solaris, AIX, and HP-UX. When people say "Unix" today, they usually mean "Unix-like" — including Linux and macOS.
Unix vs Linux vs macOS: What's the Difference?
| System | What It Is | Where You'll See It |
|---|---|---|
| Original Unix | 1969 AT&T system, now mostly historical | Legacy enterprise: Solaris, AIX, HP-UX |
| Linux | Free Unix-like OS (1991, Linus Torvalds) | ~80% of web servers, all Android devices, most cloud servers |
| BSD | Berkeley Software Distribution — Unix derivatives | FreeBSD, OpenBSD, NetBSD, foundation of macOS and PlayStation |
| macOS | BSD-based, Unix-certified by The Open Group | Every Mac since 2001 |
| WSL | Windows Subsystem for Linux | Linux on any Windows 10/11 machine |
Practically, when learning: Unix commands work on all of these. Open Terminal on macOS, open WSL on Windows, SSH into a Linux server — the commands you learn here work everywhere.
Why Learn Unix in 2026?
Three honest reasons it's still one of the most valuable skills you can pick up:
- Every server runs it. Linux dominates web hosting, cloud computing, Docker containers, and Kubernetes. AWS, Google Cloud, and Azure are Linux-first. If you deploy software, you deploy to Unix-like systems.
- The skills compound. Once you know Unix, you can use 10 different distributions, several BSDs, and macOS Terminal without re-learning anything. No other operating system family has this much portability.
- Command-line skills make you faster. A skilled Unix user does in 30 seconds what a GUI user does in 5 minutes. Bulk file rename, log searching, batch processing — all trivial on the command line.
How to Practice Unix (No Install Required)
Three options ranked by ease:
| Option | Best For | Setup |
|---|---|---|
| macOS Terminal | Mac users — you already have it | Press Cmd+Space, type "Terminal", hit Enter |
| WSL on Windows | Windows 10 or 11 users | Open PowerShell as admin, run wsl --install |
| Linux in a browser | Anyone with a browser | Online Unix terminal or Replit |
| Cloud shell | Any free Google account | Google Cloud Shell — 5GB free shell |
| Live Linux from USB | Try without installing | Download Ubuntu .iso, write to USB with Rufus or balenaEtcher |
wsl --install in PowerShell (as admin) gets you a real Ubuntu environment that runs alongside Windows, with full file system integration. It's the modern way to learn Unix on Windows.
Your First 10 Unix Commands
Open a terminal anywhere and try these. Every one works on Unix, Linux, and macOS.
# 1. Where am I? $ pwd /home/alice # 2. What's in this folder? $ ls Documents Downloads Pictures notes.txt # 3. Detailed listing (size, date, permissions) $ ls -la # 4. Change directory $ cd Documents # 5. Make a new folder $ mkdir my-project # 6. Create or edit a file $ touch notes.txt # empty file $ nano notes.txt # open in nano editor # 7. View a file $ cat notes.txt # whole file at once $ less notes.txt # scrollable, press q to quit # 8. Copy a file $ cp notes.txt backup.txt # 9. Move/rename a file $ mv notes.txt my-notes.txt # 10. Delete a file (careful — no undo) $ rm backup.txt
That's it. Master those 10 and you can navigate any Unix system. The rest of this tutorial builds from these.
The Unix File System
Unix organizes everything as a tree of directories starting at / (the "root"). Even hardware devices and running processes show up as files. The most important locations:
| Path | What's There |
|---|---|
/ | Root of the file system (everything is below this) |
/home/username | Your home directory (also ~) |
/etc | System configuration files |
/bin and /usr/bin | Essential commands (ls, cp, mv, etc.) |
/usr/local | Software installed by you or a package manager |
/var | Variable data — logs, mail, databases |
/tmp | Temporary files (deleted on reboot) |
/dev | Device files — disks, USB, terminals |
/proc | Live view of running processes (Linux) |
Pipes: The Unix Superpower
Unix's most important idea: small tools that combine. The pipe | sends one command's output to another's input. Master this, and you can do almost anything in one line.
# Find the 5 largest files in the current directory $ ls -la | sort -k5 -nr | head -5 # Count how many .txt files are here $ ls *.txt | wc -l # Find every line containing "error" in any log file $ grep -r "error" /var/log/ # Show only unique users currently logged in $ who | awk '{print $1}' | sort -u # Find all running Python processes, sorted by memory $ ps aux | grep python | sort -k6 -nr
Each command does one thing. Combined, they solve real problems.
The Vi Editor (Why You Need to Know It)
vi (or its successor vim) is the most universally available text editor on Unix systems. Even on minimal Linux installs that have nothing else, vi is there. Learning enough to be functional takes about 30 minutes.
| Action | Keys |
|---|---|
| Open a file | vi filename.txt |
| Enter insert mode (start typing) | Press i |
| Exit insert mode | Press Esc |
| Save | :w then Enter |
| Save and quit | :wq then Enter |
| Quit without saving | :q! then Enter |
| Undo | Press u (in normal mode) |
| Search | / + search term + Enter |
| Delete current line | Press dd twice |
| Copy current line | Press yy twice |
| Paste | Press p |
i first, then type. Press Esc when done, then :wq to save and quit.
Shell Scripting in 5 Minutes
A shell script is just a file containing commands you'd normally type. Save them in a .sh file, make it executable, run it like a program.
#!/bin/bash # A simple backup script DATE=$(date +%Y-%m-%d) BACKUP_DIR="/home/alice/backups" echo "Starting backup for $DATE" mkdir -p $BACKUP_DIR tar -czf $BACKUP_DIR/backup-$DATE.tar.gz /home/alice/Documents echo "Backup complete:" ls -lh $BACKUP_DIR/backup-$DATE.tar.gz
Save that as backup.sh, then:
$ chmod +x backup.sh # Make it executable $ ./backup.sh # Run it
Add it to cron and it runs automatically every night. That's the foundation of every Unix sysadmin's job.
Common Beginner Mistakes
1. Using rm Without Thinking
rm doesn't move files to a trash folder — it deletes them immediately and permanently. rm -rf / as root will destroy your system. Always check what directory you're in before rm.
2. Forgetting Case Sensitivity
Unix is case-sensitive. readme.txt and Readme.txt are different files. cd Documents and cd documents aren't the same command.
3. Spaces in Filenames
Either avoid them, or quote them:
# Broken: $ cat my notes.txt # tries to open "my" AND "notes.txt" # Fixed: $ cat "my notes.txt" $ cat my\ notes.txt # escape with backslash
4. Running Things as Root When You Don't Need To
sudo gives you root power. Use it only for system administration tasks. Routine work (editing your own files, running your own programs) should never need sudo.
5. Closing the Terminal While a Process Is Running
Closing the terminal kills running processes. If you need a long-running task to survive, prefix with nohup or use tmux/screen:
$ nohup long-script.sh &
Complete Learning Path
The 47 chapters below cover everything from "what's an operating system" to advanced system administration. Work through them in order, or jump to the section that fills your specific gap.
Part I — Unix Foundations (Chapters 1–6)
Part II — Editing & Communication (Chapters 7–9)
Part III — Shells (Chapters 10–14)
Part IV — Programming on Unix (Chapters 15–17)
Part V — Processes (Chapters 18–20)
Part VI — Document Formatting (Chapters 21–29)
Part VII — Source Control & Backup (Chapters 30–32)
Part VIII — System Administration (Chapters 33–44)
Part IX — Advanced Topics (Chapters 45–47)
Unix Command Cheat Sheet
The 30 commands that handle 90% of daily Unix work:
| Task | Command |
|---|---|
| Show current directory | pwd |
| List files | ls (basic) or ls -la (detailed) |
| Change directory | cd /path/to/dir or cd ~ (home) |
| Make directory | mkdir new-folder |
| Remove empty directory | rmdir empty-folder |
| Remove file | rm file.txt |
| Remove directory + contents | rm -rf folder/ (careful!) |
| Copy file | cp source.txt dest.txt |
| Copy directory | cp -r source/ dest/ |
| Move/rename | mv old.txt new.txt |
| View file | cat file.txt or less file.txt |
| First/last 10 lines | head file.txt / tail file.txt |
| Search inside files | grep "text" file.txt |
| Recursive search | grep -r "text" . |
| Find files by name | find . -name "*.txt" |
| Count lines | wc -l file.txt |
| Sort lines | sort file.txt |
| Unique lines only | sort file.txt | uniq |
| Disk usage | du -sh folder/ |
| Free disk space | df -h |
| Running processes | ps aux or top |
| Kill process | kill PID or kill -9 PID |
| Make executable | chmod +x script.sh |
| Change ownership | chown user:group file |
| Become root | sudo command |
| Manual page | man ls |
| Where is a command? | which python |
| Compress folder | tar -czf archive.tar.gz folder/ |
| Extract archive | tar -xzf archive.tar.gz |
| Download a file | wget URL or curl -O URL |
Frequently Asked Questions
Is Unix the same as Linux?
Not exactly, but for learning purposes the difference rarely matters. Unix is the original from 1969. Linux is a Unix-like OS from 1991 that copied Unix's design and behavior. macOS is also Unix-certified. Commands you learn for Unix work on Linux and macOS in 95%+ of cases.
Why should I learn Unix in 2026?
Almost every server runs Linux (a Unix descendant). Cloud services (AWS, GCP, Azure) are Linux-first. Docker containers run Linux. macOS Terminal is Unix. Knowing Unix is one of the highest-leverage skills in modern computing.
Is Unix hard to learn?
The first week is steep — the command line feels alien if you've only used Windows or Mac GUIs. After about 20 hours of practice, most people feel comfortable. You only need a few dozen commands to be productive.
Where can I practice Unix without installing anything?
Free options: Online terminal sites, Replit Linux containers, Google Cloud Shell (free 5GB shell), or GitHub Codespaces. If you have a Mac, the Terminal app is already Unix. If you have Windows, install WSL.
Should I learn bash or zsh?
Learn bash first — it's the default on most Linux servers and most widely documented. zsh is the default on modern macOS and adds nice features, but it's mostly compatible with bash.
What's the difference between Unix shells?
sh (1977) is the original. bash is sh-compatible with extras and is most common today. zsh is bash-like with more features, default on macOS. ksh is common on enterprise Unix. csh and tcsh have C-like syntax. For new learners: just use bash.
How long does it take to learn Unix?
Basic file commands: 1-2 hours. Comfortable in the terminal: 1-2 weeks. Shell scripting: another 2-3 weeks. System administration basics: 2-3 months. Most developers reach productive level in about 30 hours.
What jobs require Unix skills?
DevOps engineer, SRE, system administrator, cloud engineer, backend developer, security engineer, data engineer, and bioinformatics researcher all require Unix skills. Salaries for Unix-heavy roles typically run 15-30% above general developer roles.
Start Chapter 1: Operating System →Last updated: April 25, 2026.