Here are some Linux Operating System related interview questions. I would be adding more into the list and of course the answers soon.
- Linux Boot Process
- Explain the Linux Boot Process
- Which is the first user process?
- Which is the process with PID 0?
- System startup? BIOS? Power On Self Test (POST)?
- What is Init process? Functions of init process?
- What is initrd? Is it possible to boot the system without initrd?
- How to create a initrd file?
- What happens when /sbin/init is corrupted? Or doesn’t exist?
- Process states
- What are the different process states?
- Interruptible sleep vs Uninterruptible sleep
- Process priority
- What is the highest priority for a process? What is the lowest priority for a process?
- What is the NICE value?
- What is the difference between NICE value and PRIORITY value fields in top command output?
- Zombie process vs Orphan process
- What is a zombie process? How to kill a zombie process?
- What is an orphan process? Does an orphan process becomes zombie?
- If you have thousands of zombie processes, will that affect the system performance?
- How to create a sample zombie process?
- Daemon vs Process
- What is a daemon?
- What are the differences between a daemon and a process in Linux/Unix?
- How to create a daemon?
- SIGTERM signal vs SIGKILL signal
- What are the differences between SIGTERM signal and SIGKILL signal?
- Which is the default signal sent to processes when you use kill command?
- What does “kill -9” means? How it is different from regular kill command?
- What happens when you kill init (process ID 1)?
- If you send SIGKILL to a parent process who has some child processes in zombie state, will that help to get rid of zombie processes?
- Load Average
- What is load average?
- How does the load average is calculated?
- What can be considered as a good load average value?
- Troubleshooting Load Average issues
- The server is slow. How would you troubleshoot it?
- How do you handle the situation without killing any process?
- Single user mode
- What is single user mode in Linux?
- What is single user mode used for?
- How can we login to single user mode?
- If you forgot the root password, how can you reset it?
- SSH Keys
- How to configure key-based authentication for SSH?
- Is it possible to recreate a lost SSH key (private key / public key)?
- Netcat (nc command)
- Is it possible to open specific ports without running any services them?
- How can I have the system listen on a port without running the actual service/program associated with it?
- There is a change scheduled which requires a specific port accessible from world wide. How can you verify that the port is accessible from outside your network before running the actual program/service on the server?
- Argument list too long
- Error: Argument list too long. What does that error mean?
- What is the maximum limit for number of arguments that can be passed to a script or program?
- What is the solution for “Error: Argument too long” situations?
- What is the difference between exec and xargs?
- How does xargs work?
- How do you delete thousands of files inside a directory?
- List Open Files (lsof command)
- How to list all open files in the system?
- How do you determine what process has a particular file open?
- Where does the lsof get data from?
- Memory (RAM – Random Access Memory)
- How to find memory details in a system?
- Explain each fields in the “Free” command output.
- What is the difference between buffers and caches?
- When you do something like “find / -type f”, does that increases the cache or buffer?
- How to find the actual free memory (RAM) in the system?
- Different memory fields in ps command and top command outputs (RSS and SVZ).
- How to find processes with more memory usages?
- Linux memory allocation details.
- Difference between 32bit and 64bit architectures?
- Does the Linux system allocate entire requested memory initially?
- What is virtual memory?
- Is swap memory included in virtual memory?
- Init Process
- What is init?
- Can you kill init with kill command?
- Runlevels
- How to find the current runlevel on your Linux system?
- Where does the system get this information from?
- Umask
- What is the default permission for files and directories?
- How to change the default permission for files and directories?
- How to change default umask value?
- Fork () and Exec () system calls
- Which system call creates a process in Linux?
- What does fork() system call do? What does exec system call do?
- What does fork() returns?
- PROC file system (pseudo file system)
- What is /proc filesystem?
- Where you can find system tunable parameters?
- Name a few tunable system parameters.
- How to make the changes persistent?
- When you make changes with “sysctl -w” will that add entry to sysctl.conf? Do you have to restart the system to make changes into effect?
- Systat package for system resource monitoring (vmstat, iostat, sar)
- vmstat
- iostat
- sar
- mpstat
- iotop
- Sticky Bit, Setuid
- /etc/skel/ directory (default files and directories to be copied to newly created users’ home directory)
- How to remove a file using its inode number?