Linux
03 / 03

Interview Questions

Linux Interview Questions

Q: What is the Linux file permission system?

Each file has three permission sets: owner, group, others. Each set has read (r=4), write (w=2), execute (x=1). Permissions are displayed as rwxrwxrwx. Use chmod to change: 755 = rwxr-xr-x, 644 = rw-r--r--. For directories, execute means "enter". Use chown to change ownership.

Q: What is the difference between a process and a thread?

A process is an independent program execution with its own memory space, file descriptors, and PID. Threads are lightweight execution units within a process that share the same memory space. Process creation (fork) is expensive; thread creation is cheaper. Processes are isolated — one crash doesn't affect others. Thread communication is fast (shared memory) but requires synchronization.

Q: What is the difference between hard link and symlink?

A hard link is another directory entry pointing to the same inode (actual data). Deleting the original file doesn't remove data until all hard links are removed. Hard links cannot span filesystems or link to directories. A symlink (soft link) is a file containing a path to another file. It breaks if the target is deleted. Symlinks can cross filesystems and link to directories.

Q: What does 2>&1 mean in shell?

Redirects stderr (file descriptor 2) to wherever stdout (file descriptor 1) currently points. command > output.log 2>&1 sends both stdout and stderr to output.log. command 2>/dev/null suppresses only errors. command &>/dev/null suppresses all output.

Q: What is a pipe and how does it work?

A pipe (|) connects the stdout of one command to the stdin of the next. ps aux | grep nginx passes ps output to grep as input. Pipes allow building complex data processing pipelines from simple tools. Commands in a pipeline run concurrently — the kernel buffers data between them.

Q: What is the difference between kill -9 and kill -15?

SIGTERM (15) is the default kill signal — asks the process to terminate gracefully. The process can catch it, clean up resources, and exit cleanly. SIGKILL (9) cannot be caught or ignored — the kernel kills the process immediately. Always try SIGTERM first; use SIGKILL only if the process doesn't respond.

Keep your own version of these notes — editable, searchable, and organised by your stack.

Start free