Top Linux Interview Questions for Aspiring Admins

Here are key Linux interview questions organized by topic:

Core Concepts

What is the difference between a process and a thread? A process is an independent program with its own memory space; a thread is a lightweight unit within a process sharing the same memory.

What are inodes? Inodes store metadata about files (permissions, ownership, timestamps, disk block locations) but not the filename or file data itself.

Explain the boot process. BIOS/UEFI → Bootloader (GRUB) → Kernel loads → init/systemd starts → runlevel/target reached.


File System

  • Hard link vs soft link — Hard links point to the same inode; symlinks point to a path. Deleting the original breaks a symlink but not a hard link.
  • /proc filesystem — A virtual FS exposing kernel and process info in real time (e.g., /proc/cpuinfo, /proc/meminfo).
  • /etc/fstab — Defines filesystems to mount at boot.

Permissions & Users

  • chmod 755 — Owner: rwx, Group: r-x, Others: r-x
  • setuid bit — Runs executable as the file owner (e.g., passwd runs as root).
  • sudo vs susudo runs a single command as root; su switches the entire session to another user.

Processes & Performance

  • ps aux vs topps aux is a snapshot; top is real-time.
  • Zombie process — A process that has finished but its parent hasn’t called wait() to read its exit status.
  • nice / renice — Set/change process scheduling priority (-20 highest, 19 lowest).
  • Check memory usagefree -h, vmstat, /proc/meminfo

Networking

  • netstat -tulnp / ss -tulnp — List open ports and listening services.
  • iptables vs firewalld — Both manage the kernel netfilter; firewalld is a dynamic wrapper with zones.
  • Check routing tableip route or route -n
  • /etc/resolv.conf — Configures DNS nameservers.

Common Commands

TaskCommand
Find files by namefind / -name "file.txt"
Search inside filesgrep -r "pattern" /dir
Disk usagedf -h / du -sh *
Archive & compresstar -czf file.tar.gz dir/
Live log watchingtail -f /var/log/syslog
Schedule taskscrontab -e

systemd

  • systemctl status/start/stop/enable — Manage services.
  • Units — Services (.service), timers (.timer), mounts (.mount), etc.
  • journalctl -u nginx -f — Follow logs for a specific unit.

Shell Scripting

  • $? — Exit code of the last command (0 = success).
  • $@ vs $* — Both hold script arguments; $@ treats each as a separate word, $* treats all as one string.
  • 2>/dev/null — Redirect stderr to discard errors.

Tricky / Advanced Questions

  • What happens when you type a command in the shell? Shell forks a child process → exec() replaces it with the command → parent waits.
  • OOM killer — Kernel kills processes when RAM is exhausted; logs in dmesg.
  • strace — Traces system calls made by a process, useful for debugging.
  • lsof — Lists open files and which processes have them open.

Leave a Reply