Linux Certification Interview Questions [2025]

Ace Linux certification exams in 2025 with this guide featuring 100+ Linux interview questions for freshers 2025 and experienced professionals 2025. Covering Linux fundamentals, Linux command line, Linux administration, shell scripting, networking, security, containers, cloud, and real-time Linux scenario-based troubleshooting, it prepares you for RHCSA, RHCE, LFCS, and DevOps 2025 roles. Master advanced Linux tools like Docker, Kubernetes, and Ansible to excel in technical interviews.

Sep 3, 2025 - 14:55
Sep 8, 2025 - 14:59
 0  2
Linux Certification Interview Questions [2025]

Core Linux Concepts

1. What is the Linux kernel, and how does it interact with hardware?

The kernel is the core of Linux, managing CPU, memory, and I/O devices via drivers. It handles system calls from applications, translating them into hardware instructions (e.g., accessing /dev/sda for disk operations).

2. What are the advantages of Linux over other operating systems?

Linux is open-source, highly customizable, stable, and secure, with strong community support. It supports diverse hardware and is cost-effective, making it ideal for servers and cloud environments.

3. What is a Linux distribution, and how do you choose one?

A distribution (e.g., RHEL, Ubuntu, Debian) packages the kernel with tools and configurations. Choose based on use case: RHEL for enterprises, Ubuntu for ease, Arch for customization.

4. How do you identify the Linux distribution in use?

Run lsb_release -a or cat /etc/os-release to display distro name and version (e.g., Ubuntu 24.04 LTS). For kernel: uname -r (e.g., 6.5.0-21-generic).

5. What is the purpose of the shell in Linux?

The shell (e.g., Bash, Zsh) interprets user commands, executes programs, and enables scripting. Example: bash -c "uptime" shows system uptime.

6. What is the difference between a foreground and background process?

  • Foreground: Runs interactively, occupies terminal (e.g., top).
  • Background: Runs independently (e.g., sleep 100 &). Manage with jobs, fg, bg.

7. What is the /bin directory used for?

Stores essential binaries like ls, cp, mv, accessible to all users, critical for system operation, especially in single-user mode.

8. How does Linux handle process priorities?

Uses nice (start priority, -20 high to 19 low) and renice (adjust running process). Example: nice -n 10 backup.sh lowers priority.

9. What is the difference between init and systemd?

  • init: Traditional init system, sequential startup.
  • systemd: Modern, parallelizes services, manages logs, and dependencies. Example: systemctl start nginx.

10. What is the purpose of the /var directory?

Stores variable data like logs (/var/log), spool files (/var/spool), and temporary files (/var/tmp). Critical for monitoring and debugging.

File System and Storage

11. What is the role of /etc/fstab?

Defines mount points for filesystems (e.g., /dev/sda1 / ext4 defaults 0 1). Used during boot to mount disks. Edit carefully to avoid boot failures.

12. How do you create a partition in Linux?

Use fdisk /dev/sdb:

  1. Create partition: n, select type, size.
  2. Write changes: w.
  3. Verify: fdisk -l /dev/sdb.

13. What is the difference between ext4 and XFS filesystems?

  • ext4: General-purpose, reliable, supports journaling.
  • XFS: High-performance for large files, less flexible resizing. Use ext4 for desktops, XFS for big data.

14. How do you extend an LVM logical volume?

lvextend -L +10G /dev/vgname/lvname
resize2fs /dev/vgname/lvname

Adds 10GB and resizes filesystem. Verify: lvs.

15. What is the /mnt directory used for?

Temporary mount point for filesystems (e.g., USB drives). Example: mount /dev/sdc1 /mnt. Not for permanent mounts (use /etc/fstab).

16. How do you check filesystem integrity?

Run fsck /dev/sda1 on an unmounted partition. Use -y to auto-fix. Example: umount /dev/sda1 && fsck -y /dev/sda1.

17. What is a symbolic link, and how do you create one?

Points to a file path, breaks if target moves. Create: ln -s /source/file /link. Example: ln -s /etc/nginx.conf /home/user/nginx.conf.

18. How do you configure swap space?

fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

Add to /etc/fstab: /swapfile swap swap defaults 0 0. Verify: swapon --show.

19. What is the /dev directory?

Contains device files (e.g., /dev/sda for disks, /dev/null for discarding output). Managed by the kernel for hardware access.

20. How do you create a RAID array?

Use mdadm:

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
mkfs.ext4 /dev/md0

RAID 1 mirrors disks. Verify: cat /proc/mdstat.

System Administration

21. How do you check system memory usage?

  • free -h: Shows RAM/swap (e.g., used: 4G, free: 12G).
  • cat /proc/meminfo: Detailed memory stats.
    Example: Identify low memory for upgrades.

22. What is /etc/sudoers, and how do you edit it?

Grants sudo privileges. Edit with visudo:

user1 ALL=(ALL) NOPASSWD: /usr/bin/apt

Allows user1 to run apt without a password. Verify: sudo -l.

23. How do you create a new group?

groupadd developers
usermod -aG developers user1

Adds user1 to developers. Verify: groups user1.

24. What is the difference between adduser and useradd?

  • adduser: Interactive, sets up home, password, shell.
  • useradd: Low-level, requires manual setup (e.g., useradd -m -s /bin/bash user).
    Use adduser for simplicity.

25. How do you change file ownership?

chown user1:developers /file
chown -R user1:developers /dir

-R for recursive. Verify: ls -l.

26. What is systemctl, and how is it used?

Controls systemd services. Examples:

  • systemctl start apache2: Starts service.
  • systemctl enable apache2: Runs on boot.
  • systemctl status apache2: Checks status.

27. How do you schedule a one-time task?

Use at:

echo "reboot" | at 10:00 PM tomorrow

View: atq. Remove: atrm .

28. What is the /root directory?

Home directory for the root user, storing configurations and scripts (e.g., /root/.bashrc). Restricted to root access.

29. How do you monitor system processes?

  • ps aux: Lists all processes.
  • htop: Interactive, real-time view.
    Example: htop shows CPU/memory per process.

30. How do you set resource limits for users?

Edit /etc/security/limits.conf:

user1 hard nproc 100

Limits user1 to 100 processes. Verify: ulimit -u.

Networking

31. How do you configure a static IP in RHEL?

Edit /etc/sysconfig/network-scripts/ifcfg-eth0:

TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

Restart: nmcli con reload. Verify: ip addr.

32. What is the role of /etc/hosts.allow and /etc/hosts.deny?

Control access for TCP Wrappers. Example:

  • /etc/hosts.allow: sshd: 192.168.1.0/24 (allows SSH from subnet).
  • /etc/hosts.deny: ALL: ALL (blocks others).

33. How do you test network connectivity?

  • ping 8.8.8.8: Checks reachability.
  • traceroute google.com: Traces path.
  • nc -zv 192.168.1.1 22: Tests port 22.

34. What is nftables, and how does it differ from iptables?

nftables is a modern firewall replacing iptables, with simpler syntax and better performance. Example:

nft add rule ip filter INPUT tcp dport 22 accept

iptables uses separate tables; nftables unifies them.

35. How do you configure a network bond?

Create /etc/sysconfig/network-scripts/ifcfg-bond0:

DEVICE=bond0
BONDING_OPTS="mode=4 miimon=100"
IPADDR=192.168.1.100
NETMASK=255.255.255.0

Add slaves: ifcfg-eth0, ifcfg-eth1. Restart: systemctl restart network.

36. What is the purpose of /etc/resolv.conf?

Lists DNS servers (e.g., nameserver 8.8.8.8). Managed by NetworkManager or edited manually. Verify: nslookup google.com.

37. How do you set up a basic firewall with firewalld?

firewall-cmd --add-service=http --permanent
firewall-cmd --reload

Opens HTTP port. Verify: firewall-cmd --list-services.

38. What is netplan in Ubuntu?

Manages network configs. Example /etc/netplan/01-netcfg.yaml:

network:
  ethernets:
    eth0:
      addresses: [192.168.1.100/24]
      gateway4: 192.168.1.1

Apply: netplan apply.

39. How do you enable SSH key-based authentication?

  1. Generate key: ssh-keygen.
  2. Copy: ssh-copy-id user@server.
  3. Disable passwords: /etc/ssh/sshd_config, PasswordAuthentication no.
    Restart: systemctl restart sshd.

40. What is ip command used for?

Manages network interfaces and routes. Examples:

  • ip addr: Shows IPs.
  • ip route: Routing table.
    Replaces ifconfig.

Security

41. What is AppArmor, and how does it differ from SELinux?

AppArmor restricts applications via profiles (e.g., /etc/apparmor.d/). Simpler than SELinux’s complex policies. Example: aa-status lists profiles.

42. How do you enforce password policies?

Edit /etc/login.defs:

PASS_MAX_DAYS 90
PASS_MIN_LEN 8

Use pam_tally2 for login attempts. Verify: chage -l user1.

43. What is chroot jail, and how is it set up?

Isolates processes to a directory. Example:

chroot /jail

Copy binaries: cp /bin/bash /jail/bin. Enhances security for services.

44. How do you audit system security?

Use lynis:

lynis audit system

Generates a report on vulnerabilities. Install: apt install lynis.

45. What is fail2ban, and how do you configure it?

Blocks IPs after failed logins. Install: apt install fail2ban. Edit /etc/fail2ban/jail.local:

[sshd]
enabled = true
maxretry = 3

Restart: systemctl restart fail2ban.

46. How do you manage file permissions securely?

Use least privilege:

  • chmod 600 file: Owner-only access.
  • chown root file: Restrict ownership.
    Verify: ls -l.

47. What is sudoers file syntax for command aliases?

In /etc/sudoers via visudo:

Cmnd_Alias PKG = /usr/bin/apt, /usr/bin/dnf
user1 ALL=(ALL) PKG

Allows user1 to run package commands.

48. How do you disable root login?

Edit /etc/ssh/sshd_config:

PermitRootLogin no

Restart: systemctl restart sshd. Use sudo instead.

49. What is pam.d used for?

Configures Pluggable Authentication Modules for authentication (e.g., /etc/pam.d/sshd). Example: Add pam_tally2 for login limits.

50. How do you check for open ports?

ss -tuln

Lists listening ports (e.g., 0.0.0.0:22). Alternative: nmap localhost.

Performance and Monitoring

51. How do you monitor disk usage?

  • df -h: Shows filesystem usage (e.g., /dev/sda1: 70% used).
  • du -sh /dir: Directory size.
    Example: Identify large logs in /var/log.

52. What is iostat used for?

Reports CPU and disk I/O. Example: iostat -x 1 5 shows I/O stats every second. High %iowait indicates bottlenecks.

53. How do you check system load?

Run uptime or top. Example: load average: 0.8, 0.6, 0.4. Values > CPU cores indicate high load.

54. What is nmon?

A performance monitoring tool for CPU, memory, disk, and network. Install: apt install nmon. Run: nmon for interactive stats.

55. How do you analyze logs with journalctl?

Examples:

  • journalctl -u cron: Cron logs.
  • journalctl --since "2025-09-08": Logs since date.
  • journalctl -p 3: Error-level logs.

56. What is top vs. htop?

  • top: Built-in, basic process monitoring.
  • htop: Interactive, user-friendly with colors and sorting. Install: apt install htop.

57. How do you check network bandwidth usage?

  • iftop: Real-time per-connection stats.
  • vnstat: Tracks usage over time.
    Example: iftop -i eth0.

58. What is sar, and how is it used?

System Activity Reporter collects performance data. Example: sar -u 1 5 shows CPU stats. Install: apt install sysstat.

59. How do you identify a high-memory process?

Use top or ps aux --sort=-%mem. Example: ps aux | head shows top memory users.

60. What is lscpu?

Displays CPU details (cores, architecture). Example: lscpu shows 4 cores, useful for performance tuning.

Shell Scripting and Automation

61. How do you write a basic Bash script?

#!/bin/bash
echo "System uptime:"
uptime

Save as script.sh, run: bash script.sh.

62. What is a shebang line?

Defines the interpreter (e.g., #!/bin/bash). Ensures script runs with the correct shell. Example: #!/bin/zsh for Zsh.

63. How do you pass arguments to a script?

#!/bin/bash
echo "Argument 1: $1"

Run: ./script.sh test outputs Argument 1: test.

64. What is the difference between && and || in scripts?

  • &&: Runs next command if previous succeeds (e.g., ls && echo OK).
  • ||: Runs if previous fails (e.g., ls /bad || echo Failed).

65. How do you loop through files in a directory?

for file in /path/*; do
    echo "Processing $file"
done

Processes all files in /path.

66. What is sed used for?

Stream editor for text manipulation. Example: sed 's/error/warning/g' log.txt replaces “error” with “warning”.

67. How do you use awk for log analysis?

awk '/error/ {print $1}' /var/log/syslog

Prints first column of lines with “error”. Useful for parsing fields.

68. What is a here document in Bash?

Passes multi-line input. Example:

cat << EOF > file.txt
Line 1
Line 2
EOF

Creates file.txt with two lines.

69. How do you debug a Bash script?

Run with:

  • bash -x script.sh: Shows executed commands.
  • Add set -x in script for tracing.

70. What is Ansible, and how is it used in Linux?

Ansible automates tasks via YAML playbooks. Example:

- hosts: servers
  tasks:
    - name: Install nginx
      apt: name=nginx state=present

Installs nginx on remote servers.

Package Management

71. What is dnf in RHEL-based systems?

Modern package manager replacing yum. Example: dnf install httpd installs Apache. Faster dependency resolution.

72. How do you search for a package?

  • Ubuntu: apt search nginx.
  • RHEL: dnf search httpd.
    Lists available packages matching the term.

73. What is dpkg vs. apt?

  • dpkg: Low-level, manages .deb files (e.g., dpkg -i package.deb).
  • apt: High-level, handles repositories and dependencies.

74. How do you install a specific package version?

Ubuntu: apt install nginx=1.18.0-0ubuntu1.
RHEL: dnf install httpd-2.4.46.
Verify: dpkg -l nginx or rpm -q httpd.

75. What is rpm in RHEL?

Red Hat Package Manager for .rpm files. Example: rpm -ivh package.rpm installs, rpm -qa lists installed packages.

76. How do you clean up unused packages?

  • Ubuntu: apt autoremove.
  • RHEL: dnf autoremove.
    Frees disk space by removing unneeded dependencies.

77. What is a repository, and how do you add one?

A server hosting packages. Example (RHEL): Create /etc/yum.repos.d/custom.repo:

[custom]
baseurl=http://repo.url
gpgcheck=0

Update: dnf repolist.

78. How do you update the package cache?

  • Ubuntu: apt update.
  • RHEL: dnf check-update.
    Refreshes repository metadata.

79. What is snap in Ubuntu?

Package manager for self-contained apps. Example: snap install vlc installs VLC with dependencies. Useful for cross-distro apps.

80. How do you verify a package’s integrity?

RHEL: rpm -V httpd checks file changes. Ubuntu: dpkg --verify nginx ensures integrity.

Backup and Recovery

81. How do you back up a directory with tar?

tar -czf /backup/dir.tar.gz /data

Compresses /data. Restore: tar -xzf dir.tar.gz -C /restore.

82. What is rsnapshot for backups?

Automates incremental backups using rsync. Configure /etc/rsnapshot.conf:

snapshot_root /backup/
backup /home/ localhost/

Run: rsnapshot daily. Verify: ls /backup.

83. How do you restore a MySQL database?

Backup: mysqldump -u root -p db > db.sql.
Restore: mysql -u root -p db < db.sql.
Test: mysql -e "show tables".

84. What is dd used for in backups?

Copies raw data. Example:

dd if=/dev/sda of=/backup/disk.img bs=64K

Restore: dd if=/backup/disk.img of=/dev/sda.

85. How do you recover a deleted file?

If in use: lsof | grep file, copy from /proc//fd/. Otherwise, use testdisk or photorec.

86. What is rsync’s advantage for backups?

Transfers only changed data, saving bandwidth. Example:

rsync -av --delete /source /backup

Mirrors /source to /backup.

87. How do you automate nightly backups?

Script:

#!/bin/bash
rsync -av /data /backup/$(date +%F)

Cron: crontab -e, 0 1 * * * /backup.sh.

88. What is a ZFS snapshot?

Captures filesystem state. Create:

zfs snapshot pool/data@snap1

Rollback: zfs rollback pool/data@snap1. Verify: zfs list -t snapshot.

89. How do you fix a corrupted /etc/fstab?

Boot live USB, mount root: mount /dev/sda1 /mnt, edit /mnt/etc/fstab, test: mount -a.

90. What is grub.cfg, and how do you regenerate it?

Configures GRUB bootloader. Regenerate:

grub-mkconfig -o /boot/grub/grub.cfg

Verify: cat /boot/grub/grub.cfg.

Troubleshooting and Diagnostics

91. How do you troubleshoot high CPU usage?

Use top or htop to identify processes. Example: ps aux --sort=-%cpu lists top CPU users. Debug with strace -p .

92. What is lsof used for?

Lists open files/sockets. Example: lsof -i :22 shows SSH connections.

93. How do you check kernel errors?

Run dmesg | grep -i error. Example: Detects disk or driver issues.

94. What is tcpdump, and how is it used?

Captures packets. Example: tcpdump -i eth0 port 80 logs HTTP traffic. Analyze with Wireshark.

95. How do you recover a system in single-user mode?

Boot to GRUB, edit kernel line, append single, boot. Run passwd to reset root password or fsck for repairs.

96. What is strace for troubleshooting?

Traces system calls. Example: strace -p 1234 diagnoses process hangs or errors.

97. How do you troubleshoot a failed network connection?

  1. Check interface: ip link.
  2. Test: ping 8.8.8.8.
  3. DNS: nslookup google.com.
  4. Firewall: firewall-cmd --list-all.

98. What is logrotate?

Manages log files to prevent disk overuse. Example /etc/logrotate.d/syslog:

/var/log/syslog {
    daily
    rotate 7
    compress
}

Run: logrotate -f /etc/logrotate.conf.

99. How do you check for disk errors?

Run smartctl -a /dev/sda (from smartmontools) to check SMART data. Example: Look for “Reallocated_Sector_Ct”.

100. What is netstat vs. ss?

  • netstat: Legacy, shows connections/ports (e.g., netstat -tuln).
  • ss: Modern, faster (e.g., ss -tuln).
    ss is preferred in 2025.

Certification and Career

101. What are the key areas for RHCSA certification in 2025?

  • User Management: useradd, sudoers.
  • Storage: LVM, RAID, filesystems.
  • Services: systemctl, firewalld.
  • Networking: nmcli, ip.
  • Security: SELinux, AppArmor.

102. How do you prepare for Linux certification performance-based tasks?

  • Labs: Use VirtualBox or cloud platforms (AWS, GCP) to practice tasks like LVM resizing or SSH setup.
  • Commands: Master systemctl, ip, awk, sed.
  • Scenarios: Simulate failures (e.g., broken GRUB, network issues).
  • Resources: Study RHCSA/LFCS objectives, use man pages, and practice timed labs.

Tips to Ace Linux Certification Interviews

  • Hands-On Practice: Build labs to master configurations (e.g., LVM, firewalld).
  • Scripting: Write Bash scripts for tasks like backups or monitoring.
  • Explain Concepts: Simplify SELinux or LVM for non-technical audiences.
  • Stay Current: Learn 2025 trends like Docker, Kubernetes, and cloud integration.
  • Mock Exams: Use practice tests to simulate performance-based tasks.
  • Certifications: Highlight RHCSA, LFCS, or CompTIA Linux+ on your resume.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.