Quiz: Linux Fundamentals¶
5 questions
L0 (3 questions)¶
1. What does chmod 755 script.sh do?
Show answer
Sets owner read/write/execute (7), group read/execute (5), others read/execute (5). Owner can modify, everyone can run. *Common mistake:* Many people confuse the octal digits. 7=rwx, 6=rw-, 5=r-x, 4=r--.2. How do you find which process is using port 8080?
Show answer
ss -tlnp | grep 8080 or lsof -i :8080. ss is preferred on modern systems.3. What is the difference between a hard link and a soft link?
Show answer
Hard link points to the same inode (same data, survives original deletion). Soft link (symlink) points to a path (breaks if target deleted).L1 (1 questions)¶
1. What useful information is in /proc and how do you read it?
Show answer
/proc is a virtual filesystem exposing kernel and process state. Key entries: /proc/PID/status (process memory, state), /proc/PID/fd/ (open file descriptors), /proc/cpuinfo (CPU details), /proc/meminfo (memory breakdown), /proc/loadavg (load averages), /proc/mounts (mounted filesystems), /proc/net/tcp (open sockets). Read with cat — these are pseudo-files generated on demand. /proc/PID/environ shows process environment variables.L2 (1 questions)¶
1. How does the Linux virtual memory system work and what happens when RAM is full?
Show answer
Linux uses virtual memory with demand paging. Each process gets a virtual address space; pages are loaded into physical RAM on first access (page fault). The kernel maintains page cache (file data), anonymous pages (heap/stack), and mapped pages. When RAM is full:1. Kernel reclaims page cache (safe — can re-read from disk).
2. Swaps anonymous pages to swap space (slow).
3. If still insufficient, the OOM killer activates. Check: free -h (available includes reclaimable cache), /proc/meminfo (detailed breakdown), vmstat (swap in/out rates).