Interview Q&A / Linux & Shell

INTERVIEW Q&A · 63 QUESTIONS

Linux & Shell interview questions

Permissions, processes, pipes and the commands you are expected to know cold.

  1. What is the difference between a hard link and a soft link in Linux?

    A hard link is another name for the same file on disk (the same inode), so the data stays as long as any name exists. A soft (symbolic) link is a small separate file that stores a path to the target; it breaks if the target is moved or deleted, but it can point to directories and across file systems.

    IntermediateIn-depth3 min read
  2. What are /dev/null and /dev/zero, and what are they used for?

    /dev/null is a black hole: anything written to it vanishes and reading from it returns nothing. /dev/zero produces an endless stream of zero bytes. They are used to discard output and to create blank files of a given size.

    BeginnerQuick answer1 min read
  3. What is stored in /var, and why does it keep growing?

    /var holds variable data that changes while the system runs: logs, mail spools, package caches, databases and print queues. It grows because logs and caches accumulate, which is why a full /var is a common cause of a server misbehaving.

    BeginnerQuick answer1 min read
  4. What is the difference between / and /root in Linux?

    / is the root of the whole file system tree, the parent of every other directory. /root is simply the home directory of the user named root, the administrator account. The two are unrelated except by name.

    BeginnerQuick answer1 min read
  5. What is the difference between /bin, /usr/bin and /sbin?

    /bin and /usr/bin hold commands every user can run; /sbin and /usr/sbin hold system administration tools such as fdisk or iptables. On modern distributions /bin is a symlink to /usr/bin, so the old split between them no longer exists in practice.

    BeginnerQuick answer1 min read
  6. What is the difference between /tmp and /var/tmp?

    Both are for temporary files. /tmp is meant for short-lived data and is often cleared at reboot (or is even held in RAM), while /var/tmp is for temporary files that should survive a reboot.

    BeginnerQuick answer1 min read
  7. What is the purpose of the /etc directory in Linux?

    /etc holds system-wide configuration files, mostly plain text, such as user accounts, network settings, service configs and the package manager's source lists. Programs read them at start-up, so editing a file here changes how the system behaves.

    BeginnerQuick answer1 min read
  8. What is /proc in Linux, and is it a real folder on disk?

    /proc is a virtual file system created by the kernel in memory. Its files show live information about running processes and the system, such as /proc/cpuinfo and /proc/PID/status. Nothing in it is stored on disk.

    IntermediateQuick answer1 min read