The terminal looks intimidating the first time you see it — a blank black window waiting for typed commands. But this linux command line tutorial for beginners will change that. You will learn 30 essential terminal commands grouped by what they do, each with a real example you can try right now. By the end, you will navigate, create, edit, and manage files from the command line like a confident beginner, and you will know which commands are dangerous and why.
What Is the Terminal? (Linux Command Line Tutorial for Beginners)
The terminal (also called the shell or command line) is a text-based way to talk to your computer. Instead of clicking icons, you type commands and the computer answers. Developers love it because it is faster, scriptable, and available on every server in the world.
- Ubuntu/Debian: press
Ctrl + Alt + T, or search for “Terminal” in the applications menu. - macOS: open the Terminal app from Applications > Utilities (most of these commands work there too).
- Windows: install WSL (Windows Subsystem for Linux) and open Ubuntu, or use Git Bash for a lighter option.
You will see a prompt like user@laptop:~$. The ~ means your home directory, and the $ means it is ready for your command. Type a command, press Enter, and read the output. If you want to learn linux terminal skills the lasting way, type every example below instead of just reading it.
For deeper reading, the LinuxCommand.org tutorial is an excellent free companion to this guide.
Navigation: pwd, ls, cd
These three commands are where every session in this linux command line tutorial for beginners starts. Master them first.
1. pwd — print working directory. Shows where you are right now:
$ pwd
/home/alex/projects
2. ls — list files. Shows the contents of the current directory:
$ ls
notes.txt photos website
Useful flags: ls -l shows details (permissions, size, date), ls -la also shows hidden files that start with a dot.
3. cd — change directory. Move around the file system:
$ cd photos
$ pwd
/home/alex/projects/photos
$ cd .. # go up one level
$ cd ~ # jump back to your home directory
$ cd - # jump back to the previous directory
Tab-completion is your superpower: type the first letters of a folder name and press Tab to auto-complete it.
Working With Files: touch, mkdir, cp, mv, rm, cat
4. touch — create an empty file:
$ touch todo.txt
5. mkdir — make a directory:
$ mkdir projects
$ mkdir -p projects/2026/january # creates nested folders in one go
6. cp — copy files and folders:
$ cp todo.txt backup.txt
$ cp -r photos photos-backup # -r copies folders recursively
7. mv — move or rename:
$ mv old-name.txt new-name.txt # rename
$ mv notes.txt ~/documents/ # move to another folder
8. rm — remove files (handle with care):
$ rm todo.txt
$ rm -r old-project # -r deletes a folder and everything inside
Safety warning: rm deletes permanently — there is no recycle bin. Never run rm -rf / or rm -rf ~ unless you fully understand what it does, because it will wipe your system or home directory. When in doubt, use ls first to confirm what matches, and consider rm -i, which asks for confirmation before each deletion.
9. cat — print a file’s contents:
$ cat todo.txt
Buy groceries
Finish Linux tutorial
Call mom
Viewing and Searching Files: less, head, tail, grep
10. less — page through long files. Unlike cat, it lets you scroll. Press q to quit, / to search inside:
$ less /var/log/syslog
11. head — show the first 10 lines:
$ head -n 5 todo.txt
12. tail — show the last 10 lines. With -f it follows a file live, which is perfect for watching logs:
$ tail -f /var/log/syslog
13. grep — search text inside files. One of the most powerful basic linux commands:
$ grep "groceries" todo.txt
Buy groceries
$ grep -r "TODO" ~/projects # search recursively through a folder
$ grep -i "linux" notes.txt # -i ignores case
Combine commands with pipes (|), which send one command’s output into another:
$ cat todo.txt | grep -i "call"
Call mom
Permissions: chmod, chown
In this linux command line tutorial for beginners, permissions deserve their own section: every Linux file has permissions — who can read, write, and execute it. Run ls -l and you will see them:
$ ls -l script.sh
-rw-r--r-- 1 alex alex 42 Oct 11 10:00 script.sh
14. chmod — change permissions. The digits are owner/group/others, where 4=read, 2=write, 1=execute:
$ chmod +x script.sh # make a script executable
$ chmod 644 notes.txt # owner can read/write, others read-only
$ chmod 755 myscript.sh # owner full access, others read+execute
15. chown — change ownership:
$ sudo chown alex:alex project-folder
You will need sudo (superuser) for this on files you do not own. The classic beginner moment is writing a script, trying to run it, and getting “permission denied” — chmod +x is the fix.
System Monitoring: top, df, du, ps, kill
16. top — live view of running processes. Shows CPU and memory usage in real time. Press q to quit:
$ top
17. df — disk free space:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 20G 28G 42% /
The -h flag means “human readable” — use it with df and du always.
18. du — disk usage of files and folders:
$ du -sh ~/projects
2.4G /home/alex/projects
19. ps — list running processes:
$ ps aux | grep firefox
20. kill — stop a process by its ID:
$ kill 1234 # polite: asks the program to shut down
$ kill -9 1234 # forceful: use only when the program ignores kill
Find the process ID in the second column of ps output. Prefer plain kill over kill -9 — the forceful version gives the program no chance to save its work.
Networking: ping, curl, ssh
21. ping — test if a host is reachable:
$ ping -c 4 google.com
PING google.com (142.250.72.14): 56 data bytes
64 bytes from 142.250.72.14: icmp_seq=0 ttl=117 time=12.4 ms
On Linux, ping runs forever unless you add -c 4 (send 4 packets). Press Ctrl + C to stop any running command.
22. curl — download data from URLs. Developers use it constantly to test APIs:
$ curl https://api.github.com/users/octocat
23. ssh — log into a remote server securely:
$ ssh alex@192.168.1.50
This is how you manage web servers in the real world. The first connection asks you to confirm the server’s fingerprint — type yes.
Installing Software: apt and sudo
24. apt — install packages on Ubuntu/Debian:
$ sudo apt update # refresh the list of available software
$ sudo apt install htop # install the htop program
25. sudo — run a command as administrator. It stands for “superuser do.” You will use it for installs, system config, and anything outside your home folder. Type your password when asked — nothing appears on screen as you type, which is normal. Like everything in this linux command line tutorial for beginners, try it yourself to make it stick.
A full beginner workflow for installing something new looks like this:
$ sudo apt update && sudo apt install -y neofetch
$ neofetch
Help and History: man, history, echo, clear
26. man — the built-in manual for any command. Stuck on what a flag does? Read the manual:
$ man ls
Press q to exit. This single command makes you self-sufficient.
27. history — see your recent commands:
$ history | tail -n 10
Even better: press the up arrow to recall your last command, and Ctrl + R to search your history as you type.
28. echo — print text (great for testing):
$ echo "Hello, terminal!"
Hello, terminal!
$ echo "Backup done" >> log.txt # append text to a file
Note the difference: > overwrites a file, >> appends to it. Mixing them up is a classic beginner mistake.
29. clear — clean up the screen (or just press Ctrl + L).
30. exit — close the terminal session.
Putting It Together: A Mini Project
Let us combine several commands from this linux command line tutorial for beginners into one realistic task — organizing a messy downloads folder:
$ cd ~/Downloads
$ mkdir -p organized/{images,documents,archives}
$ mv *.jpg *.png organized/images/ 2>/dev/null
$ mv *.pdf *.docx organized/documents/ 2>/dev/null
$ mv *.zip *.tar.gz organized/archives/ 2>/dev/null
$ ls -R organized
$ du -sh organized/*
The 2>/dev/null part hides error messages when no matching files exist. ls -R lists everything recursively. You just automated in 6 lines what would take 10 minutes of clicking.
For command reference beyond this guide, check the Linux man-pages project.
What’s Next
You now know 30 essential commands — enough to navigate any Linux system with confidence. The natural next step is version control: our Git and GitHub tutorial for beginners shows you how to track your projects with Git, entirely from the terminal you just mastered. If you want to automate tasks with real scripts, try the Python automation scripts for beginners guide. And for the full journey from zero to developer, follow the complete roadmap for learning coding from scratch.