Unlike Windows (which uses C:\\, D:\\, etc.), **Linux has a single root directory /** everything in the system branches from.
This structure is called the **Filesystem Hierarchy Standard(FHS)** almost every Unix/Linux distro follows it.
This will include:
- Core filesystem concepts
- Critical command categories (navigation, management, processes, networking, etc.)
- Real-world examples
- Advanced use-cases relevant for a developer/sysadmin
The Filesystem Hierarchy Standard (FHS) defines the main directories and their contents in Linux operating systems.
For the most part, it is a formalization and extension of the traditional BSD filesystem hierarchy.
| Command |
Description |
Example |
pwd |
Show current directory |
pwd |
ls |
List directory contents |
ls -la /etc |
cd |
Change directory |
cd /var/log |
mkdir |
Create directory |
mkdir /tmp/testdir |
rmdir / rm -r |
Remove directory |
rm -rf /tmp/testdir |
cp |
Copy files |
cp file.txt /tmp/ |
mv |
Move/rename files |
mv test.log /var/log/ |
cat / less / head |
View file content |
less /etc/hosts |
find |
Search files by pattern |
find /etc -name "*.conf" |
du / df |
Check disk usage |
df -h, du -sh /home |
| Command |
Description |
Example |
chmod |
Change permissions |
chmod 755 script.sh |
chown |
Change owner |
chown jigar:jigar file.txt |
sudo |
Run as superuser |
sudo apt update |
su |
Switch user |
su root |
| Package Manager |
Description |
Example |
apt |
Debian/Ubuntu package manager |
sudo apt install nginx |
dpkg |
Low-level .deb manager |
sudo dpkg -i app.deb |
snap |
Universal package manager |
sudo snap install postman |
flatpak |
Sandboxed apps |
flatpak install flathub com.spotify.Client |
💡 Why your DBeaver issue happened: Apps in /opt or manual .tar.gz installs may lack permissions or system integration.APT ensures correct placement in /usr/, /lib/, /etc/ and config linking — that’s why it worked when installed with apt.
| Command |
Description |
Example |
top / htop |
Monitor running processes |
htop |
ps aux |
List all processes |
ps aux grep nginx |
kill / pkill |
Terminate processes |
kill -9 1234 |
systemctl |
Manage system services |
sudo systemctl restart nginx |
journalctl |
View logs from systemd |
sudo journalctl -u nginx |
uptime |
System running time |
uptime |
df -h |
Disk space |
df -h |
| Command |
Description |
Example |
ping |
Test connectivity |
ping google.com |
curl |
Fetch web content |
curl https://api.github.com |
wget |
Download files |
wget https://example.com/file.zip |
ifconfig / ip |
Network interfaces |
ip addr show |
netstat / ss |
Network sockets |
ss -tulpn |
scp |
Secure file copy |
scp file.txt user@server:/tmp/ |
ssh |
Remote shell |
ssh user@192.168.1.10 |
| Command |
Description |
Example |
uname -a |
Kernel info |
uname -a |
lsb_release -a |
OS version |
lsb_release -a |
hostnamectl |
Host and kernel details |
hostnamectl |
lscpu, lsblk, free -h |
Hardware info |
free -h |
df -Th |
Mounted filesystems |
df -Th |
| Command |
Description |
Example |
tar -czvf |
Create compressed archive |
tar -czvf backup.tar.gz /home/jigar |
tar -xzvf |
Extract archive |
tar -xzvf backup.tar.gz |
zip / unzip |
Zip compression |
zip -r myzip.zip folder/ |
| Command |
Description |
Example |
grub-install / update-grub |
Bootloader management |
sudo update-grub |
journalctl -xb |
Debug boot logs |
If stuck in terminal mode |
fsck |
File system check |
sudo fsck /dev/sda1 |
💡If Ubuntu boots to terminal only:It means the GUI (desktop manager) didn’t start. Check with:
sudo systemctl start gdm3 # GNOME sudo systemctl start lightdm # LightDM
| Situation |
What to Do |
| App config not working |
Check /etc/appname/ or ~/.config/appname/ |
| System running slow |
Use top, iotop, or df -h |
| Package conflict |
Use apt remove --purge, then apt autoremove |
| Broken GUI |
Switch to TTY: Ctrl + Alt + F3, login, fix from terminal |
| Debug network |
sudo systemctl restart NetworkManager |
| Manual app install |
Use /opt for third-party or /usr/local/bin for custom scripts |
Basically Linux has divided the directory structure based on the function of what is needed to make the system as secure as possible with the minimum amount of permissions needed. Otherwise someone is bound to have to do alot of avoidable work.
Remember that Unix and Linux were made as multi-user systems and Windows was created for a single user. Everything else can be explained from that idea. You can explain every directory when thinking about it being multi-user and security.