Beginner Level
60 questions covering Part 1: Linux Architecture, Processes & Memory Management.
Explain the Linux Boot Process from power-on to user login.
- BIOS / UEFI: Executes Power-On Self-Test (POST), checks hardware, and reads the bootloader from Master Boot Record (MBR) or EFI System Partition (ESP).
- Bootloader (GRUB2): Loads the compressed Linux kernel image (
vmlinuz) and initial RAM disk (initramfs) into memory. - Kernel Initialization: Mounts root filesystem in RAM, initializes hardware device drivers, and mounts real root filesystem (
/). - Init Process (
systemd- PID 1): Starts default system target (multi-user.targetorgraphical.target), spawning system daemons, network services, and login prompts (agetty).
What is
systemdand what are Units, Targets, and Timers?systemdis the Linux init system and service manager running as PID 1.- Unit: A configuration file (
.service,.socket,.mount,.timer) representing a managed system resource. - Target: A synchronization point grouping units together (e.g.,
multi-user.targetreplaces SysV init runlevel 3). - Timer: Native systemd replacement for cron, executing service units based on monotonic or calendar events.
- Unit: A configuration file (
Explain the Linux Process States (
R,S,D,Z,T).R(Running / Runnable): Process is currently executing on CPU or waiting in the run queue.S(Interruptible Sleep): Process is waiting for an event or I/O; can be awakened by signals.D(Uninterruptible Sleep - Disk Sleep): Process is waiting on hardware I/O (disk, NFS); cannot be killed bySIGKILL.Z(Zombie / Defunct): Process has completed execution, but its exit status has not been reaped by its parent process.T(Stopped / Traced): Process suspended bySIGSTOPor debugger (ptrace).
What is a Zombie Process and how do you resolve it?
A child process that has exited but remains in the process table because its parent has not invoked
wait()/waitpid(). Zombies consume process table entries (PIDs) but zero CPU/RAM. Since zombies are already dead, they cannot be killed withkill -9.- Resolution: Send
SIGCHLDto the parent process, or kill the parent process so the zombie is orphaned and adopted by PID 1 (systemd), which reaps it immediately.
- Resolution: Send
Explain Linux Load Average (1, 5, and 15-minute metrics).
The average number of processes that are in a runnable state (using or waiting for CPU) plus processes in uninterruptible sleep (
Dstate) (waiting for disk or network I/O) over 1, 5, and 15 minutes.- A load average of
4.0on a 4-core machine means 100% CPU utilization. If load average is12.0on 4 cores, CPU or disk I/O is heavily saturated.
- A load average of
Compare
top,htop, andatopfor process monitoring.top: Built-in standard real-time process monitoring utility.htop: Interactive, colorized viewer supporting mouse clicks, tree views, and easy process signal dispatching.atop: Advanced performance monitor logging historical system-level metrics (CPU, memory, disk, network) and per-process activity to disk for retrospective troubleshooting.
What is Virtual Memory and how does Paging work?
An abstraction providing each process with a private, contiguous address space. Memory is divided into fixed-size Pages (typically 4KB). The Memory Management Unit (MMU) uses Page Tables to translate virtual memory addresses to physical RAM addresses.
What is a Page Fault (Minor vs Major Page Fault)?
- Minor Page Fault: The requested memory page is already in physical RAM (e.g., shared library), requiring only updating the process page table (fast, no disk I/O).
- Major Page Fault: The requested page is not in RAM (must be read from swap space or disk filesystem), causing process latency stalls.
What is Swap Space and how does the
swappinesskernel parameter work?Dedicated disk space used as an extension of physical RAM when memory is exhausted.
vm.swappiness(0–100): Controls the kernel's aggressiveness in swapping anonymous memory pages to disk relative to reclaiming page cache (default: 60; recommended for Kubernetes/Databases: 0–10).
What is the Linux Out-Of-Memory (OOM) Killer?
A kernel mechanism activated when physical RAM and swap are completely exhausted. It computes an
oom_scorefor each process based on memory consumption andoom_score_adj, terminating the highest-scoring process withSIGKILLto prevent a full kernel panic.What is
/procfilesystem in Linux?A pseudo-filesystem (procfs) dynamically generated in memory by the kernel that acts as an interface to internal kernel data structures, process states, and runtime hardware metrics.
What is
/sysfilesystem (sysfs)?A pseudo-filesystem providing a structured, hierarchical tree of kernel objects, device drivers, and hardware subsystem settings (e.g., block devices, network interfaces, power states).
What is
systemctland how do you manage service lifecycles?CLI utility to manage systemd services:
systemctl start <service>/stop/restart/reloadsystemctl status <service>systemctl enable <service>(creates symlinks in target directories to start on boot)systemctl daemon-reload(reloads unit files from disk)
What is
journalctland how do you query system logs?Queries the systemd binary structured journal:
journalctl -u nginx.service -f(follow live service logs)journalctl -p err -b(show all error-level logs since current boot)journalctl --since "1 hour ago"
Explain File Permissions and Octal Notation (
chmod).Read (
r= 4), Write (w= 2), Execute (x= 1):chmod 755 script.sh$\rightarrow$ Owner:rwx(7), Group:r-x(5), Others:r-x(5).chmod 644 file.txt$\rightarrow$ Owner:rw-(6), Group:r--(4), Others:r--(4).
What are Special Permissions: SUID, SGID, and Sticky Bit?
- SUID (
chmod u+s/ 4000): Executes the binary with the file owner's permissions (e.g.,/usr/bin/passwdruns as root). - SGID (
chmod g+s/ 2000): New files created in directory inherit directory group ownership. - Sticky Bit (
chmod +t/ 1000): In shared directories (/tmp), only file owners or root can delete files.
- SUID (
What is a Hard Link vs a Soft Link (Symlink)?
- Hard Link: A direct directory reference pointing to the existing inode on the same filesystem. Deleting the original file does not delete the data; data is removed only when link count reaches 0.
- Soft Link (Symlink): A separate file containing a path reference to the target file. Can cross filesystems; breaks (dangling link) if the target file is deleted or moved.
What is an Inode in Linux?
A filesystem data structure storing metadata about a file: file size, ownership UID/GID, access permissions, timestamps (
atime,mtime,ctime), and data block pointers (does not store filename or actual file content).How do you troubleshoot "No space left on device" when
df -hshows disk space available?The filesystem has exhausted its Inodes (caused by millions of zero-byte temporary files or mail queue files). Verify via
df -i. Delete small orphaned files (find /tmp -type f -delete) to free inodes.What is the difference between
atime,mtime, andctime?atime(Access Time): Last time file content was read.mtime(Modification Time): Last time file content was modified.ctime(Change Time): Last time file metadata or inode attributes (permissions, ownership) changed.
Explain the Linux Filesystem Hierarchy Standard (FHS).
/bin,/usr/bin: Core user binaries./sbin,/usr/sbin: System administration binaries./etc: Host-specific configuration files./var: Variable data (logs, spool, caches)./tmp: Ephemeral temporary files (cleared on reboot)./dev: Device nodes representing hardware./proc,/sys: Virtual kernel filesystems./opt: Add-on third-party software packages.
What is LVM (Logical Volume Manager) and what are PV, VG, and LV?
Storage abstraction allowing dynamic disk resizing without repartitioning:
- Physical Volume (PV): Physical block devices (e.g.,
/dev/nvme0n1). - Volume Group (VG): Pool of storage aggregating multiple PVs.
- Logical Volume (LV): Virtual partitions allocated from a VG, formatted with filesystems (ext4, XFS).
- Physical Volume (PV): Physical block devices (e.g.,
How do you extend an ext4 and XFS filesystem dynamically using LVM?
[ bash ] # 1. Extend the Logical Volume by 50GB lvextend -L +50G /dev/vg_prod/lv_data # 2. Resize filesystem online: resize2fs /dev/vg_prod/lv_data # For ext4 xfs_growfs /mnt/data # For XFSCompare ext4 vs XFS vs Btrfs.
- ext4: Battle-tested, rock-solid, supports shrinking and online expansion.
- XFS: High-performance 64-bit journaling filesystem optimized for large files and parallel multi-threaded I/O (default in RHEL/CentOS); cannot be shrunk.
- Btrfs: Copy-on-Write (CoW) filesystem with built-in subvolumes, snapshots, and software RAID.
What is
/etc/fstaband what are the 6 fields?Defines static filesystem mounting rules on boot:
Device/UUID(e.g.,UUID=1234-...)Mount Point(e.g.,/mnt/data)Filesystem Type(e.g.,ext4,xfs)Mount Options(e.g.,defaults,noatime)Dump(0 = disable dump backup)Pass / Fsck Order(1 = root filesystem, 2 = other filesystems, 0 = skip fsck).
What is
noatimemount option and why is it used for database performance?Disables updating the inode
atimewhenever a file is read, eliminating write I/O overhead on disk during heavy read workloads.What is
tmpfsand/dev/shm?Memory-backed temporary filesystems storing files directly in virtual memory (RAM/swap) with ultra-low latency; wiped completely on reboot.
What is
straceand how do you trace a running process?Diagnostic tool intercepting and recording system calls made by a process:
[ bash ] strace -p <PID> -f -e trace=open,read,write,networkWhat is
lsofand how do you find open files/network sockets?Lists open files:
lsof -i :8080(find process listening on port 8080)lsof -p <PID>(list all files/sockets opened by a process)lsof +D /var/log(list open files in a directory).
What is
fuser?Identifies processes using specific files, directories, or sockets (
fuser -k 8080/tcpkills the process holding port 8080).What is
vmstatand what dobi,bo,wa,si,somean?Reports virtual memory statistics:
bi/bo: Blocks received from (bi) / sent to (bo) block devices (Disk I/O).wa: CPU I/O Wait percentage (CPU idle while waiting on disk).si/so: Memory swapped in (si) / out (so) from disk per second ($> 0$ indicates RAM exhaustion).
What is
iostatand what does%utilindicate?Monitors I/O device loading:
%util: Percentage of CPU time during which I/O requests were issued to the device. Approaching 100% indicates storage saturation and disk bottlenecks.
What is
netstatvsss?ssis the modern, fast replacement for legacynetstat. It dumps socket statistics directly from kernel memory (sock_diag) rather than parsing slow/proc/net/files.ss -tulpn: Show listening TCP/UDP sockets with process names and PIDs.
What is
ipcommand vsifconfig?ip(iproute2) replaces legacyifconfig:ip addr show(replacesifconfig)ip route show(replacesroute -n)ip link set eth0 up
What is
sar(System Activity Reporter)?Part of the
sysstatpackage that collects, logs, and reports historical CPU, memory, network, and disk performance data.What is
nicevsrenice?Controls process CPU scheduling priority (niceness ranges from
-20highest priority to19lowest priority, default0).nice -n 10 ./script.shrenice -n -5 -p <PID>
What is
killvspkillvskillall?kill <PID>: Dispatches a signal to a specific process ID.pkill <pattern>: Sends signals to processes matching a regex name.killall <name>: Sends signals to all processes matching exact binary name.
Explain common Linux Signals (
SIGTERM,SIGKILL,SIGHUP,SIGINT,SIGQUIT).SIGTERM(15): Graceful termination request; can be caught and handled.SIGKILL(9): Immediate forceful termination by kernel; cannot be caught or ignored.SIGHUP(1): Hangup signal; commonly used to trigger configuration reloads without process restart.SIGINT(2): Interrupt signal sent viaCtrl+C.SIGQUIT(3): Quit signal generating a core dump viaCtrl+\.
What is a Core Dump?
An on-disk snapshot of a process's memory space and register states captured at the exact moment it crashed (e.g., segmentation fault), analyzed using
gdbfor debugging.What is
gdb(GNU Debugger)?Interactive debugger for inspecting memory, call stacks, and execution points of C/Go/Rust binary programs and core dumps (
gdb /bin/app core.dump).What is
/etc/resolv.conf?Configuration file for the Linux DNS stub resolver specifying nameservers (
nameserver 8.8.8.8), search domains, and lookup options (ndots:5).What is
/etc/hosts?Static local table mapping IP addresses to hostnames evaluated before querying external DNS servers.
What is
/etc/nsswitch.conf?Name Service Switch configuration defining the lookup precedence for databases (e.g.,
hosts: files dnschecks/etc/hostsbefore querying DNS).What is
systemd-resolved?A system service providing local network name resolution, DNS caching, and LLMNR/DNS-over-TLS resolving.
What is
iptablesArchitecture (Tables, Chains, Targets)?- Tables:
filter(packet filtering),nat(address translation),mangle(header modification),raw. - Chains:
PREROUTING,INPUT,FORWARD,OUTPUT,POSTROUTING. - Targets:
ACCEPT,DROP,REJECT,SNAT,DNAT,MASQUERADE.
- Tables:
What is
nftables?The modern framework replacing
iptables,ip6tables, andarptableswith a unified syntax, single CLI (nft), and kernel bytecode engine.What is
ufw(Uncomplicated Firewall) vsfirewalld?ufw(Ubuntu/Debian): Simplified CLI frontend for managing iptables/nftables firewall rules.firewalld(RHEL/CentOS): Dynamic zone-based firewall daemon supporting runtime rule changes without dropping active connections.
What is
tcpdumpand how do you capture packets?Command-line packet analyzer:
[ bash ] tcpdump -i eth0 -nn -s0 -w capture.pcap port 443-i eth0: Interface.-nn: Do not resolve hostnames or ports.-s0: Capture full packet payload.-w file.pcap: Write to Wireshark PCAP file.
What is
iperf3?Network bandwidth testing tool measuring maximum achievable TCP/UDP throughput and packet loss between client and server.
What is
traceroutevsmtr?traceroute: Sends packets with incrementing TTLs to identify each hop in a network route.mtr(My Traceroute): Combinestracerouteandpinginto a live real-time network path diagnostics tool displaying packet loss and latency per hop.
What is
/etc/security/limits.conf(PAM Limits)?Sets user and group resource limits (max open file descriptors
nofile, max user processesnproc).What is
chrootJail?Changes the perceived root directory (
/) for a running process, isolating it from the rest of the host filesystem (precursor to Linux containers).What is
systemd-cglsandsystemd-cgtop?systemd-cgls: Displays the cgroup process hierarchy as a tree.systemd-cgtop: Monitors real-time CPU, memory, and I/O consumption per systemd cgroup service unit.
What is
sysctland/etc/sysctl.conf?CLI and configuration interface for viewing and modifying Linux kernel runtime parameters at
/proc/sys/(sysctl -papplies changes).What is
journalctl -k(dmesg)?Displays kernel ring buffer messages from systemd journal.
What is
logrotate?Linux utility that automates rotation, compression, and removal of application log files.
What is
rsyslogvssystemd-journald?systemd-journald: Captures and stores binary structured logs for systemd units.rsyslog: Traditional syslog daemon that receives logs from journald and formats/routes them to text files (/var/log/syslog) or remote syslog servers.
What is
auditd(Linux Audit Daemon)?Kernel auditing subsystem logging security events (file access, permission modifications, system calls) for compliance and intrusion detection.
What is
cronvssystemdTimers?systemd timers provide sub-second accuracy, dependency management, execution logging in journald, and monotonic timers (e.g., run 10 minutes after boot).
What is
sudovssu?su(Switch User): Switches user session, requiring the target user's password.sudo(SuperUser Do): Executes commands with elevated privileges, requiring the calling user's password, authenticated against/etc/sudoers.