Linux is a free, open-source, Unix-like operating system kernel — first released by Linus Torvalds in 1991 — that today powers everything from smartphones (Android) and web servers to supercomputers and embedded devices. Understanding it deeply means understanding how processes, memory, files, and permissions actually work under the hood.
Linux follows a layered design. At the very bottom sits the kernel, which talks directly to hardware; above it sit system libraries and utilities; and above that, the applications you actually run.
open(), read(), fork(), execve())..ko files) so drivers can be added/removed at runtime without a reboot.Almost everything in Linux is represented as a file — including devices and process information. The FHS defines a standard directory layout so that software behaves predictably across distributions.
| Path | Purpose |
|---|---|
/bin, /usr/bin | Essential user command binaries (ls, cp, bash). |
/sbin, /usr/sbin | System administration binaries (fdisk, reboot). |
/etc | System-wide configuration files (no binaries). |
/dev | Device files (e.g. /dev/sda, /dev/null). |
/proc | Virtual filesystem exposing kernel & process info in real time. |
/sys | Virtual filesystem exposing kernel/device driver state (sysfs). |
/var | Variable data: logs, caches, spool files. |
/home | Per-user personal directories. |
/tmp | Temporary files, usually cleared on reboot. |
/lib, /usr/lib | Shared libraries needed by binaries in /bin and /sbin. |
/opt | Optional third-party / add-on software packages. |
/boot | Kernel image, initramfs, and bootloader files. |
/mnt, /media | Mount points for temporary and removable filesystems. |
Every file has an owner, a group, and a permission set for owner / group / others, each with read (r), write (w), execute (x) bits. Permissions can be represented symbolically (rwxr-xr--) or numerically in octal.
| Octal | Symbolic | Meaning |
|---|---|---|
| 7 | rwx | Read + Write + Execute |
| 6 | rw- | Read + Write |
| 5 | r-x | Read + Execute |
| 4 | r-- | Read only |
| 755 | rwxr-xr-x | Common for executables/scripts. |
| 644 | rw-r--r-- | Common for regular files. |
# view permissions ls -l file.txt # -rw-r--r-- 1 dipansu dipansu 512 Sep 26 10:00 file.txt # change permissions chmod 755 deploy.sh # numeric mode chmod u+x deploy.sh # symbolic mode: add execute for owner # change ownership chown dipansu:dev file.txt # add a user to a group sudo usermod -aG docker dipansu # check current user & groups whoami groups
A process is a running instance of a program. The kernel scheduler decides which process runs on the CPU and for how long, using priority/nice values and scheduling classes.
init/systemd) is the ancestor of all others.fork() duplicates the calling process, then exec() replaces its memory image with a new program.init.SIGTERM, SIGKILL, SIGINT, SIGHUP) to request termination, interruption, or reload.& to run a job in the background; use jobs, fg, bg, and nohup to manage them.# list running processes ps aux ps -ef --forest # show process tree # live resource usage top htop # nicer, interactive (may need install) # send signals kill -15 1234 # SIGTERM: ask process 1234 to terminate gracefully kill -9 1234 # SIGKILL: force kill (uncatchable) pkill -f "python app.py" # kill by matching command name # run in background / detach from terminal long_task.sh & disown nohup long_task.sh &> out.log & # change scheduling priority nice -n 10 ./batch_job.sh renice -n 5 -p 1234
The shell is both an interactive command interpreter and a scripting language. Bash scripts let you automate repetitive sysadmin and dev tasks.
#!/usr/bin/env bash
set -euo pipefail # exit on error, unset var, or failed pipe
SRC_DIR="/home/dipansu/projects"
DEST_DIR="/backup/$(date +%Y-%m-%d)"
mkdir -p "$DEST_DIR"
for file in "$SRC_DIR"/*.log; do
if [[ -f "$file" ]]; then
cp "$file" "$DEST_DIR/"
echo "Backed up: $file"
fi
done
echo "Backup complete -> $DEST_DIR"
| chains commands together; >, >>, 2>, and &> redirect stdout/stderr to files."$var") to avoid word-splitting and glob expansion bugs.$?); 0 means success, non-zero means failure — essential for chaining with && / ||.grep (search), sed (stream editing), and awk (pattern-based field processing) form the backbone of shell text pipelines.Different distributions use different package managers, but the underlying goals — installing, updating, and removing software with dependency resolution — are the same.
| Distro Family | Package Manager | Example Commands |
|---|---|---|
| Debian / Ubuntu | APT (.deb) | apt update && apt install nginx |
| RHEL / Fedora / CentOS | DNF / YUM (.rpm) | dnf install nginx |
| Arch Linux | Pacman | pacman -S nginx |
| Any distro | Snap / Flatpak | snap install code --classic |
| Embedded (Yocto) | BitBake recipes | bitbake core-image-minimal |
ip addr show lists network interfaces and their IP addresses (replaces the older ifconfig).ip route shows the routing table; traceroute/mtr trace the path packets take to a destination.dig or nslookup resolve hostnames; /etc/resolv.conf and /etc/hosts configure resolution.ss -tulpn (or the older netstat) lists listening ports and the processes bound to them.iptables/nftables for low-level packet filtering, or ufw/firewalld for a friendlier front-end.ip addr show # list interfaces & IPs ip route # routing table ss -tulpn # listening TCP/UDP sockets + owning PID curl -I https://example.com # quick HTTP HEAD request ping -c 4 8.8.8.8 # basic reachability test dig example.com +short # DNS lookup scp file.txt user@host:/path/ # secure copy over SSH
Most modern distributions use systemd as PID 1 — it manages the boot process, services (units), sockets, timers, and logging (via journald).
systemctl status nginx # check service status systemctl start nginx # start a service now systemctl enable nginx # start automatically at boot systemctl restart nginx journalctl -u nginx -f # follow live logs for a unit journalctl -xe # recent logs with explanations # a minimal custom unit file: /etc/systemd/system/myapp.service # [Unit] # Description=My App # After=network.target # # [Service] # ExecStart=/usr/local/bin/myapp # Restart=on-failure # # [Install] # WantedBy=multi-user.target
| Command | What It Does |
|---|---|
ls -la | List all files (including hidden) with details. |
cd - | Jump back to the previous working directory. |
find / -name "*.log" | Recursively search for files by name. |
grep -rn "TODO" . | Recursively search file contents with line numbers. |
du -sh * | Show disk usage of each item in the current directory. |
df -h | Show free/used disk space per mounted filesystem. |
tar -czvf out.tar.gz dir/ | Compress a directory into a gzip tarball. |
chmod +x script.sh | Make a script executable. |
ln -s target link | Create a symbolic link. |
watch -n 2 df -h | Re-run a command every N seconds. |
history | grep ssh | Search your shell command history. |
man chmod | Open the manual page for a command. |
You need to gracefully ask a misbehaving process to shut down (allowing it to clean up), rather than force-killing it instantly. Which signal should you send?
Reading is only half the battle — these are the resources I'd genuinely recommend for actually internalizing Linux internals and daily-driver skills:
curl cheat.sh/tar.