Linux runs most of the world’s servers, cloud workloads, containers and Android phones. Whether you want to work in DevOps, cyber security or system administration, you need to be comfortable on the Linux command line. This guide covers the Linux fundamentals and basic commands every beginner should know, with short examples you can try right away.

Why learn Linux?
- It runs the internet: most web servers and cloud instances use Linux.
- It is free and open source: you can install it anywhere and study how it works.
- It is scriptable: almost every task can be automated from the shell.
- It is essential for security work: tools like Kali Linux, Wazuh and most attack tools run on Linux.
The shell and the terminal
The terminal is the window where you type. The shell is the program that reads your commands and runs them. The most common shell is Bash, while Zsh is popular on desktops.
When you open a terminal, you see a prompt like this:
alice@server:~$It shows the user, the host name, the current directory (~ means your home) and $ for a normal user. A # means you are root, so be careful.
Command structure
Most commands follow the same pattern:
command -options arguments
ls -l /etcOptions change how a command behaves, while arguments tell it what to work on.
Navigating the file system
Linux uses one tree that starts at / (root). Important directories include /home for users, /etc for configuration, /var/log for logs and /tmp for temporary files.
| Command | What it does |
|---|---|
pwd | Print the current directory |
ls -la | List all files with details |
cd /var/log | Change to a directory |
cd .. | Go up one level |
cd ~ | Go to your home directory |
An absolute path starts at /, such as /etc/hosts. A relative path starts from where you are, such as ../logs.
Working with files and directories
| Command | What it does |
|---|---|
mkdir -p projects/demo | Create directories |
touch notes.txt | Create an empty file |
cp notes.txt backup.txt | Copy a file |
mv backup.txt old/ | Move or rename |
rm notes.txt | Delete a file (there is no recycle bin) |
rm -r old/ | Delete a directory and its contents |
Be very careful with rm -r, especially with sudo.
Viewing and searching text
| Command | What it does |
|---|---|
cat file | Print a whole file |
less file | Scroll through a file |
head -n 20 file | First 20 lines |
tail -f /var/log/syslog | Follow a log as it grows |
grep -i error app.log | Find lines containing a word |
find / -name "*.conf" | Find files by name |
wc -l file | Count lines |
You can chain commands with a pipe (|). For example, ps aux | grep nginx shows only Nginx processes.
Users, permissions and sudo
Every file has an owner, a group and permissions. View them with ls -l, and change them with chmod and chown. Run administrative commands with sudo. Read more in Linux file permissions and user and group management.
Processes and system information
| Command | What it does |
|---|---|
ps aux | List processes |
top or htop | Live view of CPU and memory use |
kill PID | Stop a process |
df -h | Disk space |
free -h | Memory use |
uname -a | Kernel and system information |
ip addr | Network addresses |
Installing software
- Debian and Ubuntu:
sudo apt update && sudo apt install nginx - RHEL, Rocky and AlmaLinux:
sudo dnf install nginx
Getting help
man lsopens the manual page for a command.ls --helpshows a short summary.apropos networksearches manual pages by keyword.
Next steps
Practise every day in a virtual machine or a cloud instance. Then test yourself with our Linux quiz, and prepare for jobs with Linux interview questions.
Sources
Running Linux servers in production? Our Linux server hardening & security audit checks configuration, patching, SSH and logging. You can also use our free Linux server hardening checklist, or contact us.

Pingback: Linux File & Directory Permission - Youngster Company
Pingback: Linux User & Group Management - Youngster Company
Pingback: Linux Interview Questions - Youngster Company