🐧 Linux Interview Guide! 📚
👩💼 Are you a mid-to-advanced level Linux administrator prepping for interviews? Check out this thread with essential interview questions and their answers!
Q: What is the purpose of the 'ulimit' command in Linux?
A: 'ulimit' is used to set or display user-level resource limits. It can control processes' resource consumption, like memory or file descriptors.
#LinuxAdmin #InterviewQuestions
Q: Explain the difference between 'hard' and 'soft' limits in ulimit.
A: Hard limits are the maximum values a user can set, while soft limits can be set and changed by the user within the hard limit boundaries.
#Linux #SysAdmin
Q: Explain the purpose of the 'chroot' command in Linux.
A: 'chroot' changes the apparent root directory for a process. It's often used for creating isolated environments or for system recovery purposes.
#LinuxAdmin #Security
Q: How can you check which process is using a specific port in Linux?
A: The 'netstat' or 'ss' command can display a list of network connections, including the processes associated with specific ports.
#LinuxNetworking #SysAdmin
Q: What is SELinux, and how does it enhance Linux security?
A: SELinux (Security-Enhanced Linux) is a security framework that enforces mandatory access controls, adding an extra layer of security by limiting access to resources.
#Security #Linux
Q: Explain the purpose of 'strace' and 'ltrace' commands in Linux.
A: 'strace' traces system calls made by a process, while 'ltrace' traces library calls. They are helpful for debugging and profiling.
#Debugging #LinuxTools
Q: How do you find and kill a process by its name in Linux?
A: You can use 'pgrep' to find the process ID (PID) by name and 'kill' or 'killall' to terminate it. Be cautious when killing processes.
#LinuxCommands #SysAdmin
Q: What is 'systemd' in Linux, and how does it differ from 'init'?
A: 'systemd' is a modern init system and service manager, replacing traditional 'init'. It provides better control and management of services and dependencies.
#Systemd #Linux
Q: What is 'swappiness' in Linux, and how can you adjust it?
A: 'Swappiness' is a kernel parameter that controls the tendency to use swap space. You can adjust it with 'sysctl' or by modifying '/etc/sysctl.conf'. Lower values reduce swapping.
#LinuxMemory #SysAdmin
Q: Explain the concept of 'OOM Killer' in Linux.
A: The Out-of-Memory (OOM) Killer is a kernel feature that terminates processes when the system runs out of memory to prevent a complete system freeze. It prioritizes processes based on criteria.
#LinuxOOM #SysAdmin
Q: What is a 'cgroup' in Linux, and how does it help in process management?
A: Control groups (cgroups) are a kernel feature that manages and limits system resource usage for processes. They help allocate CPU, memory, and other resources to groups of processes.
#LinuxCgroups
Q: What is a 'kernel panic' in Linux, and how do you troubleshoot it?
A: A kernel panic is a critical error that causes the kernel to halt. To troubleshoot, review the panic message, check system logs, and analyze hardware or driver issues.
#KernelPanic #Troubleshooting
Q: Explain the 'dmesg' command in Linux and its role in kernel troubleshooting.
A: 'dmesg' displays kernel messages, including boot-time diagnostics and hardware-related information. It's helpful for identifying hardware issues and driver problems.
#LinuxKernel #SysAdmin
Q: How can you update the Linux kernel, and what precautions should you take?
A: Kernel updates can be done using package managers like 'yum' or 'apt'. Before updating, ensure backups and understand potential compatibility issues with existing drivers and modules.
#KernelUpdate
Q: Explain 'strace' and 'gdb' in the context of kernel troubleshooting.
A: 'strace' traces system calls, while 'gdb' is a debugger for user-space processes. In kernel troubleshooting, tools like 'ftrace' and 'kgdb' are used for kernel-level debugging.
#KernelDebugging
Q: Search for all occurrences of the word "error" in a set of log files located in the /var/log directory and its subdirs.
A: You can use the following grep command: grep -r "error" /var/log. This will recursively search for "error" in all files within /var/log and its subdirs.
Q: You have a CSV file named data.csv with columns: Name, Age, and City. Print only the names of people who are older than 30 years?
A: You can use this awk command: awk -F, '$2 > 30 {print $1}' data.csv. It sets the field separator as a comma and prints the names of people with an age greater than 30.
Q: Explain how to use 'find' to locate and delete files older than a certain date.
A: To find and delete files older than a specific date, use 'find' with '-mtime' and '-exec' options. For example: 'find /path/to/search -type f -mtime 7 -exec rm {} ;'
Q: What is 'kdump' in Linux, and how does it aid in kernel debugging?
A: 'kdump' is a mechanism that captures kernel crash dumps when a system experiences a kernel panic. It helps in post-mortem analysis to diagnose and fix kernel issues.
#Kdump #KernelDebugging
Q: What are Linux namespaces?
A: Linux namespaces provide resource/process isolation, making them appear isolated. They are crucial for containers like Docker. In Docker, namespaces include PID for process isolation, network for network separation, and mount for filesystem isolation.
Boost your Linux knowledge and ace those interviews! 🚀
#LinuxAdmin #InterviewQuestions