Core Concepts Quiz
Quiz
fork(), mmap(), and socket() are system calls that interact with the kernel. printf() and malloc() are library functions from glibc that may internally use system calls like write() and brk().fork(), mmap(), and socket() are system calls that interact with the kernel. printf() and malloc() are library functions from glibc that may internally use system calls like write() and brk().Linux treats almost everything as a file:
- Regular files (documents, programs)
- Directories (special files containing other files)
- Devices (hardware accessed through files)
- Pipes (inter-process communication)
- Sockets (network communication)
This unified interface simplifies system operations—the same operations (open, read, write, close) work on different types of resources.
Did you get it right?
/proc and /sys are virtual filesystems dynamically generated by the kernel. /proc provides process and kernel information, while /sys provides device and driver information./proc and /sys are virtual filesystems dynamically generated by the kernel. /proc provides process and kernel information, while /sys provides device and driver information./bin contains essential user commands, /sbin contains system administration binaries, and /usr/bin contains user applications. /etc contains configuration files, and /var contains variable data./bin contains essential user commands, /sbin contains system administration binaries, and /usr/bin contains user applications. /etc contains configuration files, and /var contains variable data./proc/cpuinfo to see CPU details?cat command reads and displays file contents. Since /proc/cpuinfo is a virtual file, cat /proc/cpuinfo displays CPU information.cat command reads and displays file contents. Since /proc/cpuinfo is a virtual file, cat /proc/cpuinfo displays CPU information.- (regular file)
/dev./dev.-rwsr-xr-x indicate?/usr/bin/passwd./usr/bin/passwd.chmod ___ document.txt/tmp, and ensures only file owners can delete their own files in shared directories. Its numeric value is 1000, not 4000 (which is SUID)./tmp, and ensures only file owners can delete their own files in shared directories. Its numeric value is 1000, not 4000 (which is SUID).sudo -i and sudo -s?sudo -i and sudo -s?sudo -i: Gives you a full login environment (like actually logging in as root)
- Changes to root’s home directory
- Loads root’s environment variables
- Sources root’s shell configuration files
sudo -s: Just elevates your privileges
- Keeps your current working directory
- Keeps your current environment
- Non-login shell
Did you get it right?
ps aux output for a process that has finished executing but is waiting to be cleaned up by its parent?ps aux | grep defunctwait(). It’s waiting to be cleaned up and only occupies a process table entry.wait(). It’s waiting to be cleaned up and only occupies a process table entry.renice command changes the priority of running processes. For example: renice -n 5 -p 1234 sets the nice value to 5 for PID 1234. nice is used when starting a new process.renice command changes the priority of running processes. For example: renice -n 5 -p 1234 sets the nice value to 5 for PID 1234. nice is used when starting a new process.sudo systemctl enable _____ nginx.service--now flag combines enable (start at boot) with start (start immediately). Without it, you’d need two commands: systemctl enable and systemctl start.--now flag combines enable (start at boot) with start (start immediately). Without it, you’d need two commands: systemctl enable and systemctl start.Systemd Targets are units that group other units and define system states.
They replace SysV runlevels:
poweroff.target→ runlevel 0 (shutdown)rescue.target→ runlevel 1 (single-user)multi-user.target→ runlevels 2,3,4 (multi-user, no GUI)graphical.target→ runlevel 5 (multi-user with GUI)reboot.target→ runlevel 6 (reboot)
Targets are more flexible than runlevels and can have dependencies.
Did you get it right?
journalctl is systemd’s integrated logging system. Use journalctl -u service-name to view logs for a specific service. For example: journalctl -u nginx.service.journalctl is systemd’s integrated logging system. Use journalctl -u service-name to view logs for a specific service. For example: journalctl -u nginx.service.systemctl daemon-reload before restarting the service.systemctl daemon-reload is required to reload systemd’s configuration. This tells systemd to re-read all unit files. Then you can restart the service with the new configuration.systemctl daemon-reload is required to reload systemd’s configuration. This tells systemd to re-read all unit files. Then you can restart the service with the new configuration.apt install, apt remove, and apt upgrade modify installed packages. apt update only refreshes the package index, apt search and apt show are informational commands that don’t modify the system.apt install, apt remove, and apt upgrade modify installed packages. apt update only refreshes the package index, apt search and apt show are informational commands that don’t modify the system.apt update will upgrade all packages on your system to their latest versions.apt update only refreshes the package index from repositories—it doesn’t upgrade anything. To actually upgrade packages, you need to run apt upgrade or apt full-upgrade.apt update only refreshes the package index from repositories—it doesn’t upgrade anything. To actually upgrade packages, you need to run apt upgrade or apt full-upgrade.___ addr showip command from iproute2 is the modern replacement for ifconfig. ip addr show displays all network interfaces and their IP addresses. It’s faster and more feature-rich than the legacy ifconfig.ip command from iproute2 is the modern replacement for ifconfig. ip addr show displays all network interfaces and their IP addresses. It’s faster and more feature-rich than the legacy ifconfig.ss -tulnp represent?ss -tulnp shows TCP and UDP listening sockets with numeric addresses and process information. It’s the modern replacement for netstat and is faster.ss -tulnp shows TCP and UDP listening sockets with numeric addresses and process information. It’s the modern replacement for netstat and is faster./etc/resolv.conf contains DNS server addresses (nameserver entries) and search domains. Each nameserver line specifies a DNS server to query for domain name resolution./etc/resolv.conf contains DNS server addresses (nameserver entries) and search domains. Each nameserver line specifies a DNS server to query for domain name resolution.R - Running or Runnable: Process is executing on CPU or waiting in run queue for CPU time
S - Interruptible Sleep: Process is waiting for an event (like I/O completion) and can be interrupted by signals
D - Uninterruptible Sleep: Process is waiting for I/O and cannot be interrupted (usually brief, indicates disk/network I/O)
Bonus states:
- T - Stopped: Paused by job control (Ctrl+Z) or debugger
- Z - Zombie: Terminated but waiting for parent to collect exit status
Did you get it right?