APURV
  • Home
  • Journey
  • Projects
  • Blogs
  • Interview
  • Exams
Resume
APURV

Building scalable, secure, and production-ready cloud infrastructure. Automation first.

NAVIGATION

HomeExperienceProjectsCertificationsSkills

TECH STACK

AWSGCPK8sCI/CDLinuxDocker

CONNECT

LinkedInGitHubEmailResume

ยฉ 2026 Apurv Gujjar. All rights reserved.
APURV
  • Home
  • Journey
  • Projects
  • Blogs
  • Interview
  • Exams
Resume
HomeInterview PortalLinux
Shell โ€ข Permissions โ€ข Systemd
ALL HANDBOOKS
๐ŸŽฏLinux๐Ÿ™Git & GitHub๐Ÿค–GitHub Actions๐ŸŒNetworkingโ˜AWS๐Ÿ› Terraform๐ŸณDockerโ˜ธKubernetes๐Ÿ”„GitOps๐Ÿ“ŠMonitoring๐Ÿ›กDevSecOpsโš™SRE๐Ÿ—System Design๐Ÿ’ฐCost Optimization๐ŸšจIncident Scenarios๐Ÿ‘คHR & Behavioralโ˜GCP๐ŸPythonโ˜AWS Architect
๐ŸŽฏ

Linux

// INTERVIEW & ARCHITECTURE HANDBOOK
Shell โ€ข Permissions โ€ข Systemd

Learn Linux core architecture, production scenario-based questions, incident response, and real-world engineering solutions.

๐ŸŽฏ Interactive Linux & Scripting Interview Q&A Handbook#



๐ŸŸข 1. Basic Linux Foundation#

โ“ Q1: Explain what Linux is and why it is widely used in DevOps environments.#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • What is Linux? An open-source, Unix-like operating system kernel developed by Linus Torvalds in 1991.
  • Why DevOps Prefers It? Widely adopted due to its:
    • Stability & Scalability: Runs continuously under heavy workloads without crashing.
    • Security & Performance: Strict privilege boundaries, resource constraints, and low footprint.
    • Automation First: Highly compatible with script automation, cloud deployments, and container runtimes (Docker/Kubernetes).

โ“ Q2: What is the Linux kernel and what role does it play in the operating system?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: The core of the Linux operating system operating in privileged mode.
  • Role & Purpose:
    • Acts as the communication bridge between user space applications and system hardware.
    • Directly manages physical hardware resources (CPU scheduling, RAM allocation, disk, and network interfaces) securely.

โ“ Q3: Explain the Linux filesystem hierarchy and the purpose of /etc, /var, /home, /tmp, and /usr.#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • /etc โ€” Configurations: Stores system-wide config files (e.g., config profiles, hosts).
  • /var โ€” Variable Data: Contains volatile files such as system/app logs and database caches.
  • /home โ€” User Space: The personal directory partition for standard non-root users.
  • /tmp โ€” Temporary Storage: Holds transient files created by running programs (regularly cleared on boot).
  • /usr โ€” System Resources: Stores system binaries, shared library files, and user programs.

โ“ Q4: What happens internally when you run the ls command in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. Command Lookup: The shell resolves the binary location (usually /usr/bin/ls).
  2. Process Spawn: The shell calls fork() to clone itself and execve() to load the ls code into memory.
  3. Kernel Execution: The kernel executes the process and assigns virtual memory space.
  4. Filesystem Read: ls calls system routines (like getdents) requesting the directory contents from the kernel.
  5. Output Rendering: The kernel retrieves data blocks from the filesystem and outputs results to your terminal window.

โ“ Q5: What is the difference between Linux and UNIX?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • UNIX: A proprietary, closed-source operating system family created by AT&T Bell Labs (e.g., AIX, Solaris). Mainly restricted to specialized enterprise mainframe systems.
  • Linux: A free, open-source UNIX-like kernel written from scratch by Linus Torvalds. Highly popular for modern cloud infrastructure, server workloads, and DevOps due to its portability, scaling, and zero licensing costs.

โ“ Q6: What is the role of the shell in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Role: A CLI command interpreter interface that bridges the user to the kernel.
  • Workflow: Reads user inputs, verifies command syntax, requests system execution from the kernel, and displays output results.
  • DevOps Benefit: Supports scripting, environment customization, and task automation.

โ“ Q7: What are the different types of shells available in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Common Shell Varieties: sh (Bourne), bash (Bourne-Again), zsh (Z Shell), ksh (Korn), and csh (C Shell).
  • Standard Selection: bash is the standard default choice for DevOps because of its robust scripting capabilities, history tracking, and universal compatibility across Linux distributions.

โ“ Q8: What is the root user and why is it powerful?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: The administrative superuser account (identified by UID 0).
  • Privilege Level: Bypasses all standard permission rules.
  • Capabilities:
    • Can view, modify, or delete any system/user file.
    • Manage software packages, configurations, network interfaces, and user groups.
    • Control active processes and shutdown the server.

๐ŸŸก 2. File System & File Operations#

โ“ Q9: How do you create, copy, move, and delete files in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Create an empty file:
    touch file1.txt
    
  • Copy a file:
    cp file1.txt file2.txt
    
  • Copy file into a directory:
    cp file1.txt /home/user/
    
  • Move or rename a file:
    mv file1.txt /home/user/
    
  • Rename a file:
    mv file1.txt newfile.txt
    
  • Delete a file:
    rm file1.txt
    
  • Delete a directory:
    rm -r foldername
    
  • Force delete (recursively):
    rm -rf foldername
    

โ“ Q10: What is the difference between cp and mv commands?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • cp (Copy):
    • Copies files or directories, meaning the original file stays the same and a duplicate is created.
  • mv (Move):
    • Moves files from one location to another or renames files/directories, and the original file is removed from the source location.

โ“ Q11: What happens if you run rm -rf / accidentally?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Execution: Forcefully and recursively deletes all files and directories starting from the root directory.
  • Consequences: If executed with root privileges, it can delete the entire operating system, making the system unusable.
  • Prevention: Modern Linux systems include safety protections (like requiring --no-preserve-root) against it.

โ“ Q12: How do you search for a file in a Linux system?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • find command: Searches for files by name, path, or size recursively in real-time within directories.
  • locate command: A faster search alternative that queries an indexed system database.
  • Note: The grep command is used to search text patterns inside files, not to locate files themselves.

โ“ Q13: What is the difference between a soft link and a hard link?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Hard Link:
    • A direct reference/pointer to the same file data on disk (inode).
    • Even if the original file is deleted, the data remains accessible through the hard link.
    • Shares the exact same inode as the original file.
  • Soft Link (Symlink):
    • A shortcut pointing to the target file path.
    • If the original file is deleted, the link breaks.
    • Has a different inode number than the original file.

โ“ Q14: When would you use a symbolic link in a DevOps environment?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Shortcuts: Used to create paths/shortcuts to files or directories.
  • Use Cases:
    • Version Switching: Swapping deployment versions seamlessly (e.g. pointing a symlink to different releases).
    • Configuration Management: Structuring enabled services (e.g., in Nginx).
    • Workflow Simplification: Changing file references without modifying hardcoded application paths.

โ“ Q15: How do you check the disk usage of a directory?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Directory Usage: Use du -sh to check the total space used by a specific directory.
    • -s = summary (total size only).
    • -h = human-readable format.
  • Filesystem Usage: Use df -h to check overall disk space usage of filesystems, not individual directories.

๐ŸŸก 3. Users & Group Management#

โ“ Q16: How do you create a new user in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Commands: Use the useradd or adduser commands with sudo privileges.
  • Password setup: After creating the user, set or change their password using the passwd <username> command.
  • Usability: The adduser command is more user-friendly because it automatically creates the home directory and guides you through setting up user details.

โ“ Q17: How do you assign a user to a group?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Command: Use the sudo usermod -aG <groupname> <username> command.
  • Options: The -aG option adds the user to a group (append to secondary groups) without removing any of their existing group memberships.
  • Verification: Group membership can be verified by running the groups <username> command.

โ“ Q18: What is the difference between a primary group and a secondary group?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Primary Group:
    • The default group assigned to a user upon creation.
    • Any file or directory created by the user belongs to this primary group by default.
  • Secondary Group:
    • An additional group that a user can join to gain extra permissions or access to specific shared system resources.

โ“ Q19: What are /etc/passwd and /etc/shadow files used for?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • /etc/passwd: Stores general user account configuration details (e.g., username, UID, GID, home directory, login shell), but does not store passwords.
  • /etc/shadow: Stores encrypted user passwords and password-aging information. It is more secure and is accessible only by the root user.

โ“ Q20: How do you delete a user and ensure cleanup of their home directory?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Delete User: Use sudo userdel <username> to remove the user account from the system.
  • Cleanup Directory: Use sudo userdel -r <username> to delete the user along with their home directory and mailbox files. The -r option ensures a complete cleanup of user data.

โ“ Q21: What is the purpose of the wheel group in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Purpose: A special Linux system group that allows its members to run commands with sudo and temporarily gain root privileges.
  • Role: It does not make the user a permanent administrator, but provides controlled and audited administrative access for security purposes.

๐ŸŸก 4. Permissions & Security#

โ“ Q22: Explain Linux file permissions (read, write, execute).#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Core Permissions:
    • Read (r): Allows viewing the contents of a file or listing files in a directory.
    • Write (w): Allows modifying file contents or adding/deleting files in a directory.
    • Execute (x): Allows running a file as a program or entering a directory.
  • Numeric Values:
    • Read = 4
    • Write = 2
    • Execute = 1
  • Combinations: These values sum up to form permission sets, e.g., 7 (4+2+1 = rwx), 5 (4+1 = r-x), and 4 (r--).

โ“ Q23: What is the numeric permission system (like 755, 644)?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Structure: Uses a three-digit sequence representing permissions for User (Owner), Group, and Others (e.g., 755 or 644).
  • Calculation: Formed by adding numeric values: Read (4), Write (2), and Execute (1).
  • Examples:
    • 755: User has full permissions (rwx = 7), while Group and Others have read/execute permissions (r-x = 5).
    • 644: User has read/write permissions (rw- = 6), while Group and Others have read-only permissions (r-- = 4).

โ“ Q24: How does chmod 777 affect security?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Meaning: Grants full read, write, and execute permissions (rwx) to User, Group, and Others (everyone on the system).
  • Security Risk: Creates a major vulnerability because anyone can modify, run, or delete the file.
  • Production Impact: Not recommended in production as it can lead to data leaks, unauthorized code changes, or severe system exploitation.

โ“ Q25: What is umask in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: A default permission mask that controls the permissions automatically assigned to newly created files and directories.
  • Mechanism: Subtracts permissions from the default system limits (which are 666 for files and 777 for directories).
  • Goal: Enforces baseline secure access control for new assets dynamically without manual user intervention.

โ“ Q26: What is ACL and why is it used in DevOps systems?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: Access Control List (ACL) is a Linux feature providing advanced file permission controls beyond the standard User-Group-Others model.
  • Feature: Allows assigning specific permissions to multiple distinct users or groups on the exact same file or folder.
  • DevOps Use Case: Manages fine-grained, secure access controls in shared environments (such as developer workspaces, shared volume mounts, or CI/CD pipelines) without compromising security.

๐ŸŸก 5. Process Management#

โ“ Q27: What is the difference between foreground and background processes?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Foreground Process:
    • Runs directly in the terminal session, blocking command input until it completes or is suspended.
  • Background Process:
    • Runs independently without blocking the terminal, allowing the user to continue working.
    • Initiated by appending an ampersand (&) to the command.
  • Process Switching: Use the fg (foreground) and bg (background) commands to switch execution modes.

โ“ Q28: What is a zombie process and how do you find one?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: A terminated child process that still remains in the process table because its parent has not read its exit status.
  • Resource Consumption: Does not use CPU or memory but occupies a process entry slot.
  • Detection: Identified using ps or top, where its status is flagged as Z.

โ“ Q29: What is an orphan process?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: A running process whose parent process has terminated.
  • Handling: In Linux, orphan processes are automatically adopted by the init or systemd process (PID 1).
  • Outcome: They continue to run normally without any issues.

๐ŸŸก 6. File Search & Text Processing#

โ“ Q30: What is grep and how is it used in log analysis?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: A Linux command used to search for patterns or keywords inside files.
  • DevOps Use Cases:
    • Log Analysis: Extensively used to filter error messages.
    • Debugging: Diagnosing applications in real-time.
    • Monitoring: Extracting relevant information from large log files.

โ“ Q31: What are awk and sed used for in DevOps?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • awk:
    • A text processing tool used to extract and analyze data from files, especially column-based data like logs.
    • Commonly used in DevOps for parsing log values.
  • sed:
    • A stream editor used to search, replace, and modify text in files.
    • Commonly used in DevOps for automated configuration file edits and text replacement scripts.

๐ŸŸก 7. Disk & Storage Management#

โ“ Q32: What is mounting and unmounting in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Mounting: Attaching a storage device or filesystem to a directory so it becomes accessible to the system.
  • Unmounting: Safely detaching it from the filesystem directory tree.
  • Importance: It is crucial to unmount storage before removal to prevent data loss or file corruption.

โ“ Q33: What is /etc/fstab used for?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: A system configuration file in Linux that defines how and where disk partitions and storage devices should be mounted automatically.
  • Usage: Enables mount points to remain persistent across system reboots.

โ“ Q34: What happens if a disk becomes 100% full in production?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Impact: Applications start failing because the system cannot write logs, temporary files, or runtime data.
  • Consequences: Can cause service crashes, API failures, and system instability.
  • DevOps Actions: Monitor disk usage proactively, clean up logs/temp files, or expand storage capacity to prevent outages.

๐ŸŸก 8. Networking#

โ“ Q35: How do you check open ports in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Commands: Use tools like netstat -tulnp, ss -tulnp, or lsof -i.
  • Outcome: These commands display listening ports, protocol types (TCP/UDP), and the specific running processes utilizing them.

โ“ Q36: What is a firewall and how does it work in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: A security system that controls incoming and outgoing network traffic based on configured rules.
  • Function: Decides which ports, IPs, and network services are allowed or blocked, protecting the system from unauthorized access.

๐ŸŸก 9. SSH & Remote Access#

โ“ Q37: What is SSH key authentication and how does it work?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Method: A secure authentication method using a pair of cryptographic keys: a private key on the client and a public key on the server.
  • How it works: Instead of passwords, the server verifies the client's private key against the pre-shared public key to authorize access.
  • Usage: Highly secure and standard in DevOps environments for automation.

โ“ Q38: What is the difference between scp and rsync?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • scp: Securely copies files between local and remote systems over SSH, but copies the entire file every single time.
  • rsync: Synchronizes files efficiently by transferring only the delta differences (changed parts), making it faster and more suitable for backups.

๐ŸŸก 10. Logging & Troubleshooting#

โ“ Q39: How do you monitor log updates in real-time?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Command: Use the tail -f <file_path> command.
  • Function: Continuously displays new lines added to a log file in real-time, aiding application monitoring and debugging.

โ“ Q40: How do you debug a failed systemd service?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. Check Status: Run systemctl status <service_name> to check current state.
  2. Inspect Logs: Check historical logs using journalctl -u <service_name>.
  3. Verify Setup: Inspect the service configuration file for invalid paths or incorrect permissions.
  4. Restart: Reboot the service after applying fixes via systemctl restart <service_name>.

๐ŸŸก 11. Services & Systemd#

โ“ Q41: What is the difference between enable and start in systemd?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • start: Used to start/launch a service immediately in the current active session.
  • enable: Configures the service to launch automatically during the system boot sequence.

๐ŸŸก 12. Package Management#

โ“ Q42: What is the difference between yum/dnf and apt?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • yum / dnf: Package managers used in Red Hat-based Linux distributions to manage RPM packages.
  • apt: Package manager used in Debian-based systems like Ubuntu to manage DEB packages.

๐ŸŸก 13. Cron & Automation#

โ“ Q43: How do you schedule and list cron tasks?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Schedule Jobs: Use crontab -e to open the cron editor to add or modify recurring tasks.
  • List Jobs: Run crontab -l to list active cron tasks.
  • Format: Defined using a time-based expression specifying when scripts or commands execute.

๐ŸŸก 14. Shell Scripting#

โ“ Q44: What is the significance of the shebang #!/bin/bash in a script?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: The #! symbol is called a shebang, consisting of a hash (#) and an exclamation mark (!).
  • Role: Placed at the start of scripts to specify which interpreter (such as /bin/bash) should execute the script.
  • Importance: Ensures all commands inside are processed by the specified shell consistently across systems.

โ“ Q45: What does $? represent in shell scripting?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Definition: A special shell variable that stores the exit status of the last executed command.
  • Meaning: A value of 0 represents success, while any non-zero value indicates failure. Helpful for scripting error handling.

๐Ÿ”ด 15. Advanced Linux (SRE / Interview Level)#

โ“ Q46: Explain the step-by-step Linux boot sequence.#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. BIOS/UEFI: Performs POST (Power-On Self-Test) and executes the bootloader from disk.
  2. GRUB Bootloader: Loads the kernel and initramfs (initial RAM disk) into memory.
  3. Kernel: Mounts the real root partition, initializes hardware drivers, and spawns the initialization daemon /sbin/init (PID 1).
  4. Systemd: Starts services concurrently to reach the multi-user execution state.

โ“ Q47: What is an Inode in the Linux filesystem?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: An Index Node (Inode) is a database entry containing metadata for a file (size, owner, permissions, pointers to disk blocks) except the filename itself. The filename-to-inode mapping is kept in directory directories.


๐Ÿ”ด 16. Real DevOps Production Scenarios#

Scenario 1: A production application server is running slow. How do you troubleshoot step-by-step?

Answer:

  1. Resource Check: Use uptime to check load averages, and htop to identify CPU/RAM hotspots.
  2. Disk Wait: Run iostat -xz 1 to check if high storage operations are blocking CPU execution (%iowait).
  3. RAM & Swap: Run free -m to check if swap memory is active (indicating memory exhaustion).
  4. Sockets: Run ss -tulnp to check port queues and active connections.
  5. Dmesg: Run dmesg -T to check for hardware alerts or OOM Killer events.

๐ŸŸฃ 17. Performance Monitoring & System Health#

โ“ Q48: How do you monitor CPU, memory, disk, and network usage in a Linux server in real time?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • CPU: htop or top (live process load), mpstat 1 (per-cpu metrics).
  • Memory: free -h -s 1 (RAM stats every second), vmstat 1 (virtual memory).
  • Disk: iostat -xz 1 (average read/write wait times).
  • Network: sar -n DEV 1 or iftop (bandwidth interface metrics).

โ“ Q49: What is load average in Linux and how do you interpret it?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: Load average is the average number of active CPU processes (state R) plus processes waiting for disk/network I/O operations (state D) over 1, 5, and 15 minutes.

  • On a 4-core CPU, a load average of 4.0 indicates 100% saturation. A load of 8.0 indicates that half the active tasks are waiting in queues for resource allocation.

โ“ Q50: What is the difference between CPU usage and load average?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • CPU Usage: The percentage of CPU cycles executing program instructions (e.g. 50%).
  • Load Average: The total process queue size. A system can have 10% CPU usage but a load average of 20 if all those processes are blocked waiting for disk blocks (state D).

๐ŸŸฃ 18. Log Rotation & Log Management#

โ“ Q51: What is log rotation, why is it required, and how does logrotate work?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: Log rotation archives active log files, compresses older entries, and creates fresh files.

  • Purpose: Prevents log files from consuming all disk space, which would crash databases and systems.
  • Mechanics: Run daily by cron, logrotate reads configurations in /etc/logrotate.d/. It rotates log files, compresses old logs, and notifies application daemons (using postrotate scripts) to start writing to the new file descriptor.

๐ŸŸฃ 19. System Security & Hardening#

โ“ Q52: How do you secure a Linux server in production?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. SSH: Disable root logins, enforce key-only logins (PasswordAuthentication no), and change the default port.
  2. Firewall: Block all ports using UFW except those explicitly required.
  3. Privilege Isolation: Minimize sudo privileges, run applications using non-privileged accounts.
  4. SELinux: Enforce Mandatory Access Control rules.
  5. Patches: Enable automated security updates.

๐ŸŸฃ 20. Boot & Recovery#

โ“ Q53: How do you recover a system if /etc/fstab is misconfigured?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. Boot into emergency/rescue mode using the root password.
  2. Remount root as read-write: mount -o remount,rw /.
  3. Open /etc/fstab and correct the disk mount UUID or comment out the line.
  4. Save and reboot.

๐ŸŸฃ 21. Storage Advanced#

โ“ Q54: What is LVM and how do you extend disk space online?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: LVM (Logical Volume Manager) abstracts physical storage into flexible partitions.

# 1. Initialize physical device
pvcreate /dev/sdc
# 2. Add to Volume Group
vgextend app_vg /dev/sdc
# 3. Resize Logical Volume and underlying filesystem online
lvextend -r -l +100%FREE /dev/app_vg/app_lv

๐ŸŸฃ 22. Networking Advanced#

โ“ Q55: What happens internally when a packet travels from client to server?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. Application Layer: App creates payload data, calls socket write().
  2. Transport Layer: TCP encapsulates data, adds source/target ports, sets up handshake.
  3. Network Layer: IP encapsulates packet, resolving route targets.
  4. Link Layer: MAC framing is added, NIC sends frame.
  5. Target Receive: NIC receives frames, triggers interrupt, kernel parses headers, routes packet to the target application port queue.

๐ŸŸฃ 23. Process & Kernel Advanced#

โ“ Q56: What is context switching?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The kernel action of saving the current CPU execution state (registers, memory maps) of an active thread and loading the saved execution state of another thread. It is resource-intensive.


๐ŸŸฃ 24. Automation & DevOps Practices#

โ“ Q57: What is idempotency in automation?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The quality of a script or tool (like Ansible) to produce the exact same system configuration state regardless of how many times it is run, without producing errors or side effects.


๐ŸŸฃ 25. Incident Handling#

โ“ Q58: Production outage occurs at midnight โ€” what is your step-by-step response?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. Triage: Confirm service downtime.
  2. Mitigate: Run rollback, clear disk leaks, or spin up redundant instances to restore service immediately.
  3. Communicate: Notify stakeholders with incident updates.
  4. Investigate: Audit logs and metrics to find root cause.
  5. Postmortem: Draft incident summary and prevention plans.

๐ŸŸฃ 26. Advanced File System Internals#

โ“ Q59: What is Inode table exhaustion?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: Occurs when a disk partition runs out of Index Nodes (Inodes) to store file metadata entries, preventing the creation of new files, even if the disk has free physical capacity. Verify using df -i.


๐ŸŸฃ 27. Final DevOps Real-World Thinking#

โ“ Q60: You are given access to a new Linux server with no documentation โ€” how do you understand its purpose?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. Services: systemctl list-units --type=service --state=running.
  2. Ports: sudo ss -tulnp.
  3. Processes: ps auxf.
  4. History: history.
  5. Mounts: df -h and cat /etc/fstab.

๐Ÿ”ด ADVANCED LINUX DEEP DIVE (35 ADDITIONAL Q&As)#

๐Ÿง  1. Kernel & Internals#

โ“ Q61: What is the difference between user space and kernel space?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • User Space: The restricted memory area where user applications, shells, and daemons run. Programs here have no direct access to system hardware or kernel memory and must interact via system calls (syscalls).
  • Kernel Space: The privileged memory area where the core operating system (kernel) executes. It has unrestricted access to the CPU, physical RAM, network cards, and physical storage devices.

โ“ Q62: What are system calls (syscalls) in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: A system call is the programmatic interface (API) that allows user-space applications to request services from the kernel. Examples include:

  • read() / write(): Input/Output operations on file descriptors.
  • open() / close(): Allocate/release file access.
  • fork(): Duplicate the calling process.
  • execve(): Load and run a new executable binary.

โ“ Q63: What is CPU scheduling in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: CPU scheduling decides which process gets execution time on a CPU core. Modern Linux uses the Completely Fair Scheduler (CFS):

  • CFS models a "perfect multi-tasking CPU" on real hardware.
  • It tracks execution time for each process using a metric called Virtual Runtime (vruntime).
  • The scheduler always selects the process with the smallest vruntime to run next, utilizing a Red-Black tree structure to retrieve processes in $O(\log N)$ time.

โ“ Q64: What is context switching?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The kernel operation where the state (registers, program counter, memory maps) of an active thread or process is saved, and the state of another thread is loaded onto the CPU core so execution can switch to the new process. High rates of context switching indicate resource contention.


๐Ÿ’พ 2. Memory Management#

โ“ Q65: What is virtual memory?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: An abstraction layer that gives each process the illusion of having a large, contiguous block of memory. The hardware Memory Management Unit (MMU) translates these virtual addresses to actual non-contiguous physical addresses in RAM or swap partitions.

โ“ Q66: What is paging?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The memory management scheme where virtual and physical memory are divided into fixed-size blocks called Pages (typically 4KB in size). When physical RAM becomes low, the kernel moves inactive pages from RAM to disk swap space.

โ“ Q67: What is page fault?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: An interrupt triggered by the hardware MMU when a process attempts to access a virtual memory page that is not currently loaded in physical RAM. The kernel catches this interrupt, loads the required page from disk (or swap) into RAM, and resumes the process.

โ“ Q68: What is OOM killer?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The Out-Of-Memory (OOM) killer is a kernel daemon that acts when both physical RAM and swap space are completely exhausted. It calculates badness scores and automatically terminates processes consuming high memory with low priority to prevent the entire operating system from crashing.


๐Ÿ“‚ 3. File System Deep Concepts#

โ“ Q69: What is superblock?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: A metadata block in Unix/Linux filesystems (like ext4) that stores file system-wide properties: total size, block size, empty/used blocks, total inode counts, status flags, and magic numbers identifying the filesystem type.

โ“ Q70: What is journaling in ext4?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: Journaling maintains a dedicated log file (the journal) where file write intentions are written before changes are applied to the main filesystem blocks. If a server loses power mid-write, the kernel reads the journal on reboot to complete or roll back incomplete writes, preventing filesystem corruption.

โ“ Q71: Difference between ext3 and ext4?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • ext3: Supported journaling but had a file size limit of 2TB and maximum volume size of 16TB.
  • ext4: Extends size support (16TB file limit, 1EB volume limit), utilizes extents (contiguous block tracking to reduce fragmentation), performs delayed allocation to disk, and features faster filesystem checking (fsck).

โ“ Q72: What happens when file is deleted in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. The directory entry linking the filename to its Inode number is removed.
  2. The inode's hard link count is decremented by 1.
  3. If the link count reaches 0 and no running process holds an open file descriptor to the file, the block addresses are marked as free in the filesystem allocation bitmap.
  4. The actual data remains on disk until overwritten by new file writes.

๐Ÿ” 4. Permissions (Deep Level)#

โ“ Q73: What happens internally when chmod is executed?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The command executes the chmod() system call. The kernel locates the target file's inode and modifies the 9 permission bits (representing user, group, and other read/write/execute flags) along with special bits (SUID, SGID, Sticky). This updates the filesystem metadata without altering the file's data blocks.

โ“ Q74: What is effective user ID?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • Real User ID (RUID): Identifies the actual user who launched the process.
  • Effective User ID (EUID): The user identity used by the kernel to evaluate permissions when the process attempts to access files or network resources.
  • SUID Role: When a standard user runs an SUID executable (like passwd), the RUID remains the standard user, but the EUID changes to root, granting root-level file access.

โ“ Q75: What is sticky bit used for?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: When set on a directory (e.g. chmod +t /tmp), it restricts file deletion. A user can only delete or rename files they personally own, even if the directory itself has 777 permissions.


โš™๏ธ 5. Process Management (Advanced)#

โ“ Q76: What is init process?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The first process started by the Linux kernel during the boot sequence (always assigned PID 1). It serves as the root ancestor of all user space processes, adopts orphan processes, and coordinates service launches. In modern systems, this is managed by systemd.

โ“ Q77: What is orphan process?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: A running process whose parent process terminated before it did. In this scenario, the parent child linkage is broken, and the child is adopted by the initialization daemon (systemd / PID 1) to ensure its eventual exit code is reaped.

โ“ Q78: What is fork bomb?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: A denial-of-service attack where a process continually spawns new copies of itself recursively until the system runs out of PID slots.

  • Classic Bash syntax: :(){ :|:& };:
  • Prevention: Edit /etc/security/limits.conf to set maximum process limits (nproc) for non-root users:
    *   hard    nproc   2048
    

โ“ Q79: What is nice value?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The nice value is a user-space parameter ranging from -20 (highest priority) to 19 (lowest priority). It tells the kernel scheduler how "nice" a process should be to other processes. The lower the nice value, the higher CPU scheduling priority it receives.


๐Ÿ”Œ 6. Device & Hardware#

โ“ Q80: What is /dev directory?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The directory containing device node files representing physical and virtual hardware (e.g. storage disks /dev/sda, terminals /dev/tty, null device /dev/null). It implements the Unix design principle that "everything is a file".

โ“ Q81: What is kernel driver?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: A module of code loaded into kernel space that acts as a translator, allowing the kernel to communicate with specific physical hardware devices or virtual network controllers.

โ“ Q82: What is udev?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The dynamic device manager daemon in Linux. It runs in user space, monitors kernel events (via uevent) when hardware is hot-plugged, and automatically creates or removes corresponding device nodes in the /dev directory.


๐Ÿ“ก 7. Signals#

โ“ Q83: What are signals in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: Asynchronous notifications sent by the kernel to a process (or between processes) to inform it of events or request state changes (e.g. SIGINT to interrupt, SIGSEGV for segmentation fault).

โ“ Q84: Difference between SIGKILL and SIGTERM?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  • SIGTERM (15): Request to terminate. The target process can intercept, block, or ignore this signal to run cleanup procedures before exiting.
  • SIGKILL (9): Immediate termination. The signal cannot be intercepted, blocked, or ignored by the process, and the kernel destroys the process immediately.

๐Ÿ“Š 8. Performance & Debugging (Linux Only)#

โ“ Q85: What is iowait?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The percentage of CPU idle time during which the system had outstanding disk or network I/O write/read requests. High iowait indicates storage bottlenecks.

โ“ Q86: What is load average really measuring?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The total number of processes using or waiting for CPU cycles (state R) plus those blocked waiting for disk/network I/O (uninterruptible sleep - state D). It is an indicator of system saturation, not just CPU execution.

โ“ Q87: What is vmstat used for?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: Prints real-time statistics regarding virtual memory paging, CPU execution, processes, block I/O, trap interrupts, and context switching.

โ“ Q88: What is strace?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: A diagnostic tool that runs an executable and prints every system call (open, read, write) it triggers along with their arguments and return codes, useful for debugging execution failures.

โ“ Q89: What is lsof?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: List Open Files. It lists all active files, directories, network sockets, and pipes held open by running processes, which is useful for identifying lock-holders or listening ports.


๐Ÿ”ฅ 9. Boot & System (Advanced Gap)#

โ“ Q90: What is initramfs?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: An initial RAM-based filesystem loaded into memory by the bootloader during system startup. It contains the drivers and scripts required to initialize disks (like RAID, LVM, or encrypted partitions) so the kernel can mount the real root filesystem /.

โ“ Q91: What is runlevel in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: A software configuration state in System V init systems that dictates what services run.

  • 0: Shutdown.
  • 3: Multi-user text console interface.
  • 5: Graphical GUI interface.
  • 6: Reboot.
  • systemd equivalent: Multi-user target interfaces (multi-user.target).

๐Ÿงจ 10. Final Real Interview Questions#

โ“ Q92: Why does Linux prefer command line over GUI for servers?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer:

  1. Resource Efficiency: GUIs consume substantial RAM, CPU, and GPU resources that should be reserved for application workloads.
  2. Automation: Text commands are natively scriptable, repeatable, and integrates into CI/CD pipelines.
  3. Security: A CLI minimizes the server's footprint and attack surface by removing complex GUI application dependencies.

โ“ Q93: Why is everything treated as a file in Linux?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: It provides a uniform interface. The same system calls (open, read, write, close) are used to read text configurations, write blocks to physical hard disks, query system processes (/proc), send data over network sockets, and interact with hardware devices.

โ“ Q94: What happens when CPU is fully utilized?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: New processes must wait in the CPU run queue. The load average increases, process scheduling latency increases, and application response times drop.

โ“ Q95: What happens when inode table is full?#

Click on the dropdown below to reveal the technical answer.

๐Ÿ’ก Reveal Technical Answer

Answer: The system cannot create any new file metadata entries, meaning file creation attempts will return a No space left on device error, even if there is ample physical disk space available.


Back to PortalGit & GitHub
On This Page
1. Basic Linux Foundation2. File System & File Operations3. Users & Group Management4. Permissions & Security5. Process Management6. File Search & Text Processing7. Disk & Storage Management8. Networking9. SSH & Remote Access10. Logging & Troubleshooting11. Services & Systemd12. Package Management13. Cron & Automation14. Shell Scripting15. Advanced Linux (SRE / Interview Level)16. Real DevOps Production Scenarios17. Performance Monitoring & System Health18. Log Rotation & Log Management19. System Security & Hardening20. Boot & Recovery21. Storage Advanced22. Networking Advanced23. Process & Kernel Advanced24. Automation & DevOps Practices25. Incident Handling26. Advanced File System Internals27. Final DevOps Real-World ThinkingADVANCED LINUX DEEP DIVE (35 ADDITIONAL Q&As)1. Kernel & Internals2. Memory Management3. File System Deep Concepts4. Permissions (Deep Level)๏ธ 5. Process Management (Advanced)6. Device & Hardware7. Signals8. Performance & Debugging (Linux Only)9. Boot & System (Advanced Gap)10. Final Real Interview Questions
APURV

Building scalable, secure, and production-ready cloud infrastructure. Automation first.

NAVIGATION

HomeExperienceProjectsCertificationsSkills

TECH STACK

AWSGCPK8sCI/CDLinuxDocker

CONNECT

LinkedInGitHubEmailResume

ยฉ 2026 Apurv Gujjar. All rights reserved.