Your Guide to Linux Interview Success: 60 Must-Know Questions

I'm Rudraksh Laddha — a DevOps engineer and emerging full-stack developer, passionate about building scalable, reliable systems that solve real-world problems.
With a solid foundation in cloud infrastructure automation using tools like Kubernetes, Docker, Terraform, and AWS, I thrive in environments where efficiency, resilience, and automation are key.
But my journey doesn't stop at infrastructure. I'm actively expanding into full-stack development, building dynamic applications using React, Node.js, and MongoDB. Whether it's designing cloud-native CI/CD pipelines or developing intuitive user interfaces, I enjoy creating end-to-end solutions — from server to screen.
Right now, I'm: 🧩 Building full-stack applications that merge DevOps reliability with engaging frontend experiences 🛠️ Contributing to open-source projects, learning through collaboration and real-world scenarios 🚀 Growing Virendana Ui, my own UI library focused on expressive, clean design systems 🚀 Growing Learn Virendana, where I share my personalized learning journey — from beginner to experienced 🎮 Developing side projects like 2048 Rush, blending product thinking with scalable infrastructure My long-term goal? To bridge DevOps and development — building products that are not just functional and fast, but also resilient, beautiful, and ready for scale.
System Administration & Commands
What is the purpose of the
/etc/fstabfile, and how does it work?- Answer: The
/etc/fstabfile is a configuration file that contains information about disk drives and partitions and how they should be mounted by the system. Each line specifies a device, its mount point, filesystem type, and mount options. The system uses this file during boot to mount filesystems automatically.
- Answer: The
How do you check disk usage by file and directory size on a Linux system?
Answer: You can use the
du(disk usage) command to check the size of files and directories:du -sh *This command provides a summary (
-s) and human-readable (-h) sizes for each item in the current directory.
What is the difference between a hard link and a soft link (symlink) in Linux?
- Answer: A hard link is a direct reference to the inode of a file on disk, allowing multiple filenames to reference the same file. If the original file is deleted, the hard link remains functional. A soft link (symlink) is a reference to another filename, which can point to files on different file systems. If the original file is deleted, the symlink becomes broken.
Explain how the
chmod,chown, andchgrpcommands work.Answer:
chmod: Changes the file permissions. For example,chmod 755 filenamegrants read, write, and execute permissions to the owner and read and execute permissions to others.chown: Changes the file owner. For example,chown user:group filenamechanges the file's owner touserand group togroup.chgrp: Changes the group ownership of a file. For example,chgrp groupname filenamechanges the group of the file togroupname.
How do you view running processes on a Linux system? What are the differences between
ps,top, andhtop?Answer:
ps: Displays a snapshot of current processes. For example,ps auxshows all processes.top: Provides a dynamic real-time view of running processes, updating periodically.htop: An enhanced version oftopthat allows for easy navigation and process management, including killing processes directly.
How can you schedule tasks in Linux using
cronandat?Answer:
cron: Used for recurring tasks. You can edit the cron jobs usingcrontab -e, where each line represents a scheduled task with time and date fields.at: Used for one-time tasks. You can schedule a task usingecho "command" | at 10:00, which will execute the command at 10:00 AM.
What is the purpose of the
/procdirectory in Linux?- Answer: The
/procdirectory is a virtual filesystem that provides process and system information in real-time. It contains files that represent kernel and process information, such as CPU statistics, memory usage, and process details.
- Answer: The
How do you check system logs in Linux, and where are they stored by default?
Answer: System logs are typically stored in the
/var/logdirectory. You can view logs using commands likecat,less, ortail. For example, to view the system log:less /var/log/syslog
Explain the purpose and usage of the
sudocommand.Answer: The
sudocommand allows a permitted user to execute a command as the superuser or another user, as specified by the security policy. It is used to perform administrative tasks without logging in as the root user. For example:sudo apt update
What is the difference between
kill,killall, andpkill?Answer:
kill: Sends a signal to a process by PID. For example,kill 1234sends the default SIGTERM to process 1234.killall: Sends a signal to all processes by name. For example,killall firefoxterminates all Firefox processes.pkill: Sends a signal to processes based on name and other attributes. For example,pkill -u usersends a signal to all processes owned by the specified user.
How do you create and manage user accounts in Linux, and what files are involved in user management?
Answer: You can create a user account using the
useraddcommand:sudo useradd usernameTo set the password, use:
sudo passwd usernameUser information is stored in
/etc/passwd, and passwords are hashed in/etc/shadow.
How do you change the default shell for a user in Linux?
Answer: You can change the default shell using the
chshcommand:chsh -s /bin/bash username
What is a runlevel, and how do you manage runlevels in Linux (now replaced by systemd targets)?
- Answer: A runlevel is a predefined state of the machine that determines which services are running. Common runlevels include 0 (halt), 1 (single-user), 3 (multi-user), and 5 (multi-user with GUI). You can manage runlevels using the
initcommand orsystemctlwith systemd.
- Answer: A runlevel is a predefined state of the machine that determines which services are running. Common runlevels include 0 (halt), 1 (single-user), 3 (multi-user), and 5 (multi-user with GUI). You can manage runlevels using the
What are inodes, and how are they used in Linux file systems?
- Answer: An inode is a data structure on a filesystem that stores information about a file or directory, such as its size, ownership, permissions, and data block locations. Each file has a unique inode number.
How do you extend a partition and resize a file system in Linux without losing data?
Answer: You can use
resize2fsfor ext2/3/4 filesystems andlvextendfor LVM (Logical Volume Management). For example:sudo lvextend -L +10G /dev/mapper/vg0-lv0 sudo resize2fs /dev/mapper/vg0-lv0
How do you mount and unmount file systems in Linux?
Answer: To mount a filesystem, use:
sudo mount /dev/sdb1 /mntTo unmount, use:
sudo umount /mnt
What is the difference between swap memory and physical memory (RAM) in Linux?
- Answer: Swap memory is disk space used to extend physical memory (RAM) when the RAM is full. It allows the system to run larger applications but is slower than RAM. Linux uses a swap space to manage memory efficiently.
How do you monitor disk I/O activity in real-time?
Answer: You can use the
iostatcommand from thesysstatpackage to monitor disk I/O statistics:iostat -x 1This command provides extended I/O statistics every second.
Explain the significance of
/dev/nulland how you use it in Linux commands.Answer:
/dev/nullis a special file that discards all data written to it, acting as a black hole. It is used to suppress output from commands. For example:command > /dev/null 2>&1This command redirects both stdout and stderr to
/dev/null.
What is the purpose of the
stracecommand, and how do you use it for debugging?Answer: The
stracecommand is used to trace system calls made by a program. It helps in debugging by showing how a program interacts with the kernel. For example:strace -o output.txt ./my_programThis command runs
my_programand logs all system calls tooutput.txt.
Networking & Security
Explain how the
iptablesfirewall works in Linux and how you would create basic rules.Answer:
iptablesis a user-space utility for configuring the Linux kernel firewall. It works by filtering packets based on predefined rules. For example, to allow HTTP traffic:sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPTTo save the rules, use:
sudo iptables-save > /etc/iptables/rules.v4
What is the difference between TCP and UDP, and how can you list the services using specific ports?
Answer: TCP (Transmission Control Protocol) is connection-oriented and ensures reliable data delivery, while UDP (User Datagram Protocol) is connectionless and does not guarantee delivery. To list services using specific ports, you can use:
netstat -tuln
How do you check the active network connections and listening services on a Linux system?
Answer: You can use the
sscommand to check active network connections and listening services:ss -tuln
How do you troubleshoot DNS issues in Linux, and what commands do you use?
Answer: You can troubleshoot DNS issues using commands like
dig,nslookup, andhost. For example:dig example.comThis command queries DNS servers for the IP address of
example.com.
How do you configure static IP addresses and DNS settings on a Linux system?
Answer: For a static IP configuration, you can edit the
/etc/network/interfacesfile (on Debian-based systems) or use NetworkManager. For example, in/etc/network/interfaces:iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8
What is
SELinux, and how does it work to enhance security in Linux?Answer: SELinux (Security-Enhanced Linux) is a security module that provides mandatory access control (MAC). It restricts users and programs to the minimum permissions necessary, protecting the system from misconfigured services and vulnerabilities. You can check the status with:
sestatus
Explain how to set up SSH key-based authentication for a Linux server.
Answer: To set up SSH key-based authentication:
Generate an SSH key pair:
ssh-keygenCopy the public key to the server:
ssh-copy-id user@remote_hostLog in to the server without a password.
How do you use
scpandrsyncfor secure file transfer between Linux machines?Answer:
scp: Securely copies files between hosts. For example:scp file.txt user@remote_host:/path/to/destinationrsync: Synchronizes files/directories between local and remote systems. For example:rsync -avz /local/dir user@remote_host:/remote/dir
What is the purpose of the
/etc/hostsfile, and how is it used?Answer: The
/etc/hostsfile maps hostnames to IP addresses. It allows for local name resolution before querying DNS. For example:127.0.0.1 localhost 192.168.1.10 myserver.local
How can you restrict user access to a Linux system using
iptablesor/etc/hosts.deny?Answer: To restrict user access with
iptables, you can drop connections from specific IP addresses:sudo iptables -A INPUT -s 192.168.1.100 -j DROPUsing
/etc/hosts.deny, you can deny access to all services:ALL: 192.168.1.100
How do you use the
tcpdumpcommand to capture network traffic on a specific interface?Answer: The
tcpdumpcommand captures and analyzes network traffic. To capture packets on a specific interface:sudo tcpdump -i eth0
What is the purpose of the
ufwfirewall in Linux, and how do you manage firewall rules with it?Answer:
ufw(Uncomplicated Firewall) is a user-friendly interface for managing firewall rules. To enable it:sudo ufw enableTo allow SSH connections:
sudo ufw allow ssh
How do you create a secure tunnel between two Linux systems using
ssh?Answer: You can create a secure tunnel using SSH port forwarding. For example, to forward local port 8080 to remote port 80:
ssh -L 8080:localhost:80 user@remote_host
How would you troubleshoot slow network performance on a Linux system?
- Answer: Troubleshooting slow network performance involves checking network configuration, using tools like
ping,traceroute,iperf, and monitoring bandwidth usage withiftopornload.
- Answer: Troubleshooting slow network performance involves checking network configuration, using tools like
Explain the difference between symmetric and asymmetric encryption and how you can implement them on a Linux system.
Answer: Symmetric encryption uses a single key for both encryption and decryption, while asymmetric encryption uses a pair of keys (public and private). You can implement symmetric encryption using tools like
openssl:openssl enc -aes-256-cbc -salt -in file.txt -out file.encFor asymmetric encryption:
openssl genpkey -algorithm RSA -out private.pem openssl rsa -pubout -in private.pem -out public.pem
What are the common security best practices for securing a Linux server?
Answer: Common best practices include:
Keep the system and applications updated.
Use strong passwords and change them regularly.
Disable unused services and ports.
Implement firewalls and configure
iptablesorufw.Use SSH key-based authentication and disable root login.
Regularly back up data and logs.
Processes & Performance
How do you change the priority of a process in Linux using
niceandrenice?Answer: You can set the priority of a new process using
nice:nice -n 10 commandTo change the priority of an existing process:
renice 10 -p 1234
What is a daemon process in Linux, and how does it differ from regular processes?
- Answer: A daemon process is a background service that runs independently of user control, typically starting at boot. It often listens for requests and performs tasks, whereas regular processes interact directly with users.
How do you find out which process is using the most CPU or memory in real-time?
Answer: You can use the
toporhtopcommands to view real-time resource usage. Thepscommand can also be used to filter processes by resource usage:ps aux --sort=-%mem | head -n 10 # Top 10 memory-consuming processes
How do you limit the CPU or memory usage of a process in Linux?
Answer: You can use
cpulimitto limit CPU usage:cpulimit -l 50 -p 1234 # Limit process 1234 to 50% CPUTo limit memory usage, you can use
ulimit:ulimit -v 500000 # Limit virtual memory to 500 MB
Explain how memory is managed in Linux, including concepts like virtual memory and memory swapping.
- Answer: Linux uses virtual memory to allow processes to use more memory than physically available. The kernel manages this by swapping out inactive pages to swap space on disk, freeing up RAM for active processes. The
vmstatcommand can provide insights into memory usage and swapping.
- Answer: Linux uses virtual memory to allow processes to use more memory than physically available. The kernel manages this by swapping out inactive pages to swap space on disk, freeing up RAM for active processes. The
What is a zombie process, and how can you identify and deal with it in Linux?
- Answer: A zombie process is a process that has completed execution but still has an entry in the process table, typically because its parent hasn't read its exit status. You can identify zombie processes using
ps aux | grep Z. They are usually cleared when the parent process reads their status.
- Answer: A zombie process is a process that has completed execution but still has an entry in the process table, typically because its parent hasn't read its exit status. You can identify zombie processes using
How does the
systemdinit system work in Linux, and how do you manage services with it?Answer:
systemdis an init system that initializes user space and manages system processes. You can manage services using thesystemctlcommand:sudo systemctl start service_name sudo systemctl enable service_name sudo systemctl status service_name
How do you use the
vmstatcommand to monitor system performance?Answer: The
vmstatcommand provides a summary of system performance, including memory, swap, I/O, and CPU usage. For example:vmstat 1 5 # Provides stats every second for 5 seconds
How do you diagnose and troubleshoot a high load average on a Linux system?
- Answer: To diagnose high load average, check the output of
toporhtopto identify resource-heavy processes. Analyze CPU and memory usage, disk I/O, and check for any processes stuck in uninterruptible sleep (Dstate). Useiostatandvmstatfor deeper insights.
- Answer: To diagnose high load average, check the output of
46
. What are the main differences between systemd and init.d? - Answer: systemd is a modern init system that manages services and dependencies efficiently, supports parallel service startup, and provides better logging with journald. init.d uses a traditional method with scripts for service management and starts services sequentially.
Disk Management
How do you check disk usage and available space in Linux?
Answer: You can use the
dfcommand to check disk usage:df -h # Shows human-readable disk space usageFor more detailed information about individual directories, use
du:du -sh /path/to/directory
Explain how to create and manage disk partitions in Linux.
Answer: You can create and manage disk partitions using tools like
fdisk,parted, orgparted. For example, to create a new partition withfdisk:sudo fdisk /dev/sdaFollow the prompts to create a new partition.
How do you format a disk with a specific filesystem type?
Answer: To format a disk with a specific filesystem type (e.g., ext4):
sudo mkfs.ext4 /dev/sdb1 # Replace /dev/sdb1 with the actual device
What is the purpose of the
fstabfile, and how is it used?Answer: The
/etc/fstabfile contains information about filesystems and their mount points. It is used to automatically mount filesystems at boot. An entry might look like:/dev/sdb1 /mnt/data ext4 defaults 0 2
How do you check and repair a corrupted filesystem in Linux?
Answer: You can check and repair a corrupted filesystem using
fsck:sudo fsck /dev/sdb1 # Replace with the actual device
What is LVM, and how does it benefit disk management in Linux?
- Answer: LVM (Logical Volume Manager) allows for flexible disk management by creating logical volumes that can be resized and managed independently of the underlying physical disks. It facilitates easier partition resizing and better storage utilization.
How do you create a disk image of a partition in Linux?
Answer: You can create a disk image using the
ddcommand:sudo dd if=/dev/sda1 of=/path/to/image.img bs=4M
What is the purpose of the
swapspace in Linux, and how do you configure it?Answer: Swap space is used when the physical RAM is full, allowing the system to continue functioning by temporarily moving inactive pages to disk. To configure swap, you can create a swap file:
sudo fallocate -l 1G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
User & Group Management
How do you create a new user and set a password in Linux?
Answer: You can create a new user and set a password using the following commands:
sudo adduser newuser sudo passwd newuser
What are the different user types in Linux, and how do they differ?
Answer: The main user types are:
Root: The superuser with full access to the system.
Regular users: Have limited permissions, typically their own home directories.
Service accounts: Used by system services, often with restricted access.
How do you manage user groups in Linux?
Answer: You can manage user groups using the following commands:
To create a group:
sudo groupadd groupnameTo add a user to a group:
sudo usermod -aG groupname username
How do you change file permissions and ownership in Linux?
Answer: Use the
chmodcommand to change permissions:chmod 755 file.txtUse the
chowncommand to change ownership:sudo chown user:group file.txt
What is the purpose of the
/etc/passwdand/etc/shadowfiles?- Answer: The
/etc/passwdfile contains user account information, including username, user ID, group ID, and home directory. The/etc/shadowfile stores encrypted user passwords and password expiration information, providing an additional layer of security.
- Answer: The
How do you view and manage user login attempts in Linux?
Answer: You can view login attempts in the
/var/log/auth.logfile (on Debian-based systems) or the/var/log/securefile (on Red Hat-based systems). Use commands likelastto view user login history:last




