Linux – Practical guide
This page is intended as a compact but useful Linux reference.
All examples are generic and applicable to most Linux distributions
(Debian/Ubuntu, RHEL/Fedora, Arch, Alpine), unless otherwise stated.
1. File structure and navigation
Linux works with a single central tree structure (/), not with drive letters like in Windows.
Important folders:
/– root of the system/home– personal user folders/etc– configuration files/var– variable data (logs, mail, cache)/usr– programs and libraries/tmp– temporary files/srv– data for services (web, applications)
Navigation is done entirely through the terminal. You always work from a "current directory."
View the current path:
pwd
Show files and folders in the current directory:
ls
ls -lah
Options:
-lshows a list view-aalso shows hidden files-hmakes sizes readable
Navigating through the folder structure:
cd /path/to/folder
cd ..
cd ~
2. Managing files and folders
Files and folders are created, moved, and deleted entirely via commands.
Create a folder:
mkdir folder
mkdir -p a/b/c
-p ensures that missing intermediate directories are also created.
Create an empty file or update the timestamp:
touch file.txt
Copying files or folders:
cp source dest
cp -a source dest
-a (archive) preserves permissions, ownership, and symlinks and is almost always recommended.
Move or rename files or folders:
mv old new
Delete files and folders:
rm file
rm -r folder
rm -rf folder
-r= recursive-f= forced, without confirmation
Use rm -rf only if you know what you are doing.
Create a symbolic link:
ln -s target link
3. Viewing and Reading Files
Various tools are available for viewing files, depending on size and usage.
Show full content:
cat file
Suitable for small files.
Interactive viewing (scrolling and searching):
less file
View the first or last lines:
head -n 20 file
tail -n 20 file
Follow a file live (for example logs):
tail -f /var/log/syslog
4. Searching and filtering text
Linux offers powerful tools for searching and filtering text, especially in logs and configuration files.
Searching for text:
grep "text" file
grep -R "text" folder
grep -Rni "tekst" folder
Options:
-R= recursive-n= line number-i= case insensitive
Searching for files by name:
find . -name "*.log"
Search files by modification date:
find . -type f -mtime -7
Extracting columns or fields from text:
awk '{print $1}' file
cut -d: -f1 file
5. Rights and ownership
Linux works with users, groups, and permissions per file.
View rights:
ls -l
Adjust rights:
chmod 644 file
chmod 755 script.sh
Meaning:
644= read/write for owner, read for others755= executable by everyone
Adjust owner and group:
chown user:group file
View current user and groups:
id
groups
6. Processes and system status
Linux provides extensive insights into active processes and system usage.
Show all processes:
ps aux
Live overview of CPU and memory:
top
htop
View memory usage:
free -h
Disk space per filesystem:
df -h
Size of a folder:
du -sh folder
Terminate a process:
kill PID
kill -9 PID
-9 forces shutdown and should only be used as a last resort.
7. Network and connectivity
Network status and connectivity are essential for servers and applications.
Network interfaces and routes:
ip a
ip r
Listening ports and processes:
ss -tulpn
Test network connection:
ping domain.tld
Executing HTTP requests:
curl https://site.tld
curl -I https://site.tld
Requesting DNS information:
dig domain.tld
Checking if a port is reachable:
nc -vz host 443
8. Services and logs (systemd)
Most modern Linux systems use systemd for service management.
Status and management of services:
systemctl status service
systemctl start service
systemctl stop service
systemctl restart service
systemctl reload service
Services start automatically at boot:
systemctl enable service
systemctl disable service
View logs:
journalctl -u service
journalctl -u service -f
journalctl -p err
9. Package managers
Software is installed via the package manager of the distribution.
Debian / Ubuntu (apt)
apt update
apt install package
apt remove package
apt purge package
apt autoremove
RHEL / Fedora (dnf)
dnf install package
dnf remove package
dnf search package
Arch (pacman)
pacman -S package
pacman -Rns package
pacman -Syu
Alpine (apk)
apk add package
apk del package
10. Git – version control
Git is used for version control of code and configuration.
Base commands:
git init
git clone url
git status
git add .
git commit -m "description"
Synchronizing with a remote:
git pull --rebase
git push
Insight into changes:
git log --oneline --graph
git diff
11. Docker – containers
Docker makes it possible to run applications in isolation.
Managing images in containers:
docker pull image
docker images
docker ps
docker ps -a
Starting and managing a container:
docker run -d -p 8080:80 image
docker logs container
docker exec -it container sh
Docker Compose:
docker compose up -d
docker compose down
12. Basic security
A minimal security baseline is essential, especially on servers.
Firewall (Ubuntu):
ufw status
ufw allow 22
ufw enable
Nftables (low-level firewall):
nft list ruleset
Protection against brute-force attacks:
fail2ban-client status
Automatic security updates:
apt install unattended-upgrades
13. Frequently Used Utilities
curl,wget– HTTP requestsjq– Process JSONrsync– efficient file synchronizationtmux– multiple shells in one sessionncdu– analyze disk spacelsof– open files and portstcpdump– inspect network traffic
