Linux: The Terminal and How to Actually Use It
The file system, the shell, permissions, processes, and the commands that cover most of everyday Linux - without the overwhelm.
Knowing what Linux is does not tell you how to use it.
Part 1 covered the architecture - the kernel, the layers, the distro families. This part covers what you actually do once you are inside a Linux system: the file system, the terminal, the commands, and the things that trip people up the most.
None of this requires memorising a lot. It requires understanding a few core ideas, and then everything else becomes pattern-matching.
Part 1 covers the architecture and all its flavors.
The terminal
The terminal is a text interface to the operating system.
Instead of clicking icons and opening menus, you type commands. The system reads them, does something, and prints a response. That is the whole model.
It feels old-fashioned. It is not. The terminal is faster for most system tasks, automatable in ways a graphical interface cannot match, and the only real option for working on a remote server - which has no screen at all.
The program that reads your commands and figures out what to do with them is called the shell. The most common shell on Linux is Bash. You may also encounter Zsh (the default on macOS, common on Linux too). Basic commands work the same in both.
When you open a terminal, you see a prompt - a line ending in $ (or # if you are root). Everything you type appears after it.
The file system
This is the first thing to get right, because everything else depends on it.
Linux organises all files in a single tree starting at /. This is called the root directory. Every file and folder on the system - regardless of which drive or partition it lives on - exists somewhere inside this tree.
There is no C:\ or D:\. There are no drive letters. Everything is one unified hierarchy.
Some directories you will encounter constantly:
/home- personal files for each user. If your username ismia, your home folder is/home/mia./etc- configuration files. Almost every installed program stores its config here./var- data that changes while the system runs: logs, caches, databases./tmp- temporary files. Usually cleared on reboot./usr- installed programs and their supporting files./binand/sbin- essential system commands./dev- device files. Your hard drive is probably/dev/sda. A USB drive might be/dev/sdb./proc- a virtual filesystem that exposes live information about running processes and the kernel. Not real files on disk.
~ is shorthand for your home directory. If you are logged in as mia, ~ means /home/mia. You will see this constantly.
Paths are either absolute or relative.
An absolute path starts from / and gives the full location: /home/mia/documents/notes.txt.
A relative path starts from wherever you currently are: documents/notes.txt (if you are already in /home/mia).
Navigation
These five commands cover almost all navigation.
pwd - print working directory. Tells you where you are right now.
pwd
# /home/mia
ls - list the contents of a directory.
ls
ls -l # detailed list with permissions, size, date
ls -la # same, but also shows hidden files (names starting with .)
ls /etc # list a specific directory without going there
cd - change directory.
cd documents # go into the documents folder (relative)
cd /home/mia # go there directly (absolute)
cd .. # go up one level
cd ~ # go home
cd - # go back to the previous directory
mkdir - make a directory.
mkdir projects
mkdir -p projects/work/2026 # create nested directories all at once
touch - create an empty file, or update a file's timestamp if it already exists.
touch notes.txt
Working with files
cp - copy.
cp notes.txt notes-backup.txt # copy a file
cp -r projects/ projects-backup/ # copy a directory (need -r for recursive)
mv - move or rename.
mv notes.txt documents/notes.txt # move to another location
mv notes.txt renamed.txt # rename in place
rm - delete.
rm notes.txt # delete a file
rm -r old-project/ # delete a directory and everything inside it
rm -r on the wrong directory is one of the most damaging things you can do on a Linux system. There is no recycle bin. Read your command before you run it.
Reading files
cat - print the whole file to the terminal.
cat notes.txt
less - read a long file one screen at a time. Press space to go forward, b to go back, q to quit.
less /var/log/syslog
head and tail - see the first or last lines of a file.
head notes.txt # first 10 lines
tail notes.txt # last 10 lines
tail -n 50 notes.txt # last 50 lines
tail -f server.log # watch a file update in real time - useful for logs
grep - search for a pattern inside a file.
grep "error" server.log # find lines containing "error"
grep -i "error" server.log # case-insensitive
grep -r "TODO" ~/projects/ # search recursively through a directory
Pipes: connecting commands together
The | symbol takes the output of one command and passes it as input to the next.
cat server.log | grep "error" | tail -20
That reads the log, filters for lines with "error", and shows the last 20. Each command does one thing. The pipe connects them.
Pipes are where the terminal becomes genuinely powerful. Simple commands chained together can do things no single command can.
Permissions
Linux is a multi-user system. Every file has an owner and a set of rules about who can do what with it.
Run ls -l and you see something like this:
-rwxr-xr-- 1 mia staff 4096 Mar 28 script.sh
The first column is the permission string. Read it as: one character for the file type, then three groups of three.
rwx- what the owner can do (read, write, execute)r-x- what the group can do (read, execute, but not write)r--- what everyone else can do (read only)
r = read, w = write, x = execute. A - means that permission is not granted.
chmod changes permissions.
chmod +x script.sh # make a file executable
chmod 755 script.sh # set permissions numerically (owner=rwx, group=rx, others=rx)
chown changes ownership.
chown mia:staff file.txt # set owner to mia, group to staff
The superuser and sudo
Root is the superuser. Root can do anything on the system - read any file, delete anything, change anything.
Being logged in as root all the time is dangerous. One wrong command and there is nothing stopping you from breaking the entire system.
Instead, Linux gives you sudo - a way to run a single command with root privileges.
sudo apt update
You will be asked for your password. That command runs as root. The next command goes back to your normal user.
If a command fails with permission denied, sudo is often the answer. But understand why you need it before adding it - it is not a magic prefix to paste in front of anything that fails.
Processes
A process is a running program. Every time you open a terminal, run a script, or start an application, the system creates a process. Each process has a unique PID (process ID).
ps aux - list all running processes.
top - a live view of processes, CPU usage, and memory. Press q to quit.
htop - a better version of top. Not always installed by default, but worth installing.
sudo apt install htop
htop
kill - send a signal to a process.
kill 1234 # ask process 1234 to stop (sends SIGTERM)
kill -9 1234 # force-kill it immediately (sends SIGKILL)
To kill something by name instead of PID:
pkill firefox
Package managers: installing software
Do not download software from websites and run installers. On Linux, you use a package manager.
The package manager talks to an official repository of software maintained by the distribution. Packages are vetted, signed, and have their dependencies tracked. Installing, updating, and removing is clean.
On Debian / Ubuntu (the most common):
sudo apt update # refresh the list of available packages
sudo apt install nginx # install nginx
sudo apt upgrade # update all installed packages
sudo apt remove nginx # remove nginx
sudo apt autoremove # clean up packages no longer needed
On Fedora / Red Hat:
sudo dnf install nginx
sudo dnf update
sudo dnf remove nginx
On Arch:
sudo pacman -S nginx # install
sudo pacman -Syu # update everything
sudo pacman -R nginx # remove
Editing files in the terminal
At some point you will need to edit a file without a graphical editor.
Nano is the beginner-friendly option. It shows its own keyboard shortcuts at the bottom of the screen.
nano filename.txt
Edit the file. Ctrl+X to exit. It will ask if you want to save.
Vim is on virtually every Linux system, including ones with no other editor installed. It is famous for being hard to exit. The essentials:
- Press
ito enter insert mode (so you can type) - Press
Escto leave insert mode - Type
:wqthenEnterto save and quit - Type
:q!thenEnterto quit without saving
You do not need to learn Vim deeply. You need to know how to get out of it.
SSH: connecting to remote machines
SSH (Secure Shell) lets you connect to a remote Linux machine and use its terminal as if you were sitting in front of it.
ssh username@hostname
Where hostname is an IP address or domain name. You will be asked for the password of that user on the remote machine.
SSH is how all server management happens. You open a terminal on your laptop, SSH into a server running somewhere in a data centre, and work from there - same commands, same file system structure, same everything.
SSH keys are a more secure alternative to passwords. Instead of typing a password each time, you have a key pair: a private key (on your machine, never shared) and a public key (placed on the remote server). When you connect, they are matched cryptographically.
ssh-keygen # generate a key pair
ssh-copy-id username@hostname # install your public key on the remote machine
ssh username@hostname # now connects without a password
The one thing that makes it all click
The terminal is not hard because Linux is obscure.
It feels hard because it does not suggest options to you. In a GUI, the possibilities are visible - you scroll through menus until you find what you need. In the terminal, you have to know what you want before you can ask for it.
That is a different skill, not a harder one. And once you have it, you move faster than any GUI allows.
Learn the file system first. Then navigation. Then file operations. Then permissions. Everything else is built from those same pieces.
That is really the whole thing.