Top 30 Linux System Admin Interview Questions And Answers

Are you preparing for a Linux System Administrator interview? Linux is the backbone of many IT infrastructures, and system administrators play important role in maintaining it. To help you succeed, we have compiled the top 30 Linux System Admin interview questions and answers that cover a wide range of topics. Whether you’re a fresher or an experienced professional, these questions will help you ace your next interview.

Without any further delay, let’s deep dive into questions and answers.

Q:1 Why LVM is required ?

Ans: LVM stands for Logical volume management. It is the recommended method to manage disk or storage on a Linux server. LVM partition can be resized online without any downtime.

Q:2 a) How to check memory and CPU stats ?

Ans: Using the free and vmstat commands, we can display physical and virtual memory statistics, respectively. The sar command helps us view CPU utilization and other system statistics.

b) What is the purpose of /etc/passwd file?

Ans: The /etc/passwd file stores user account information such as username, user ID (UID), group ID (GID), home directory, and shell.

c) What is the role of sudo in Linux?

Ans: sudo allows non-root users to execute commands with administrative privileges.

Q:3 What does sar provides and on which location sar logs are stored ?

Ans: The sar command collects, reports, and saves system activity information. The default report, which shows CPU utilization, is often one of the first tools a user runs when investigating system activity, as it monitors key system resources. If CPU utilization is near 100% (user + nice + system), the workload is considered CPU-bound.

By default, the log files of the sar command are located at /var/log/sa/sadd, where the dd parameter represents the current day.

Q:4 How to increase the size of LVM partition ?

Ans: Below are the Logical Steps :

  • Use the lvextend command (lvextend -L +100M /dev/<Name of the LVM Partition> , in this example we are extending the size by 100MB.
  • resize2fs /dev/<Name of the LVM Partition>
  • check the size of partition using df  command

Q:5 How to reduce the size of LVM partition ?

Ans: Though it is not recommended to reduce the size of LVM as it may lead to data corruption.

Below are the logical steps to reduce size of LVM partition :

  • Umount the filesystem using umount command
  • Use resize2fs command , e.g resiz2fs /dev/mapper/myvg-mylv 10G
  • Now use the lvreduce command , e.g lvreduce -L 10G /dev/mapper/myvg-mylv

Above Command will shrink the file system & will make the filesystem size 10 GB.

 Q:6 How to create partition on the raw disk ?

Ans: Using fdisk utility we can create partitions on the raw disk. Below are the logical steps to create partition on the raw disk,

  • fdisk  /dev/hd* (IDE) or /dev/sd* (SCSI)
  • Type n to create a new partition.
  • After creating partition , type w command to write the changes to the partition table.
  • Type ‘partprobe’ to instruct the kernel to re-read the partition table.
  • Use mkfs command to format the partition

 Q:7 Where the kernel modules are located ?

Ans: The ‘/lib/modules/kernel-version/’ directory stores all kernel modules or compiled drivers in Linux operating system. Using ‘lsmod command’ we can also see all the installed kernel modules.

Q:8 What is umask ?

Ans: umask stands for ‘User file creation mask’, which determines the settings of a mask that controls which file permissions are set for files and directories when they are created.

Q:9 How to set the umask permanently for a user?

Ans: To set this value permanently for a user, it has to be put in the appropriate profile file which depends on the default shell of the user.

Q:10 How to Boot RHEL / Rocky Linux / CentOS in Single User Mode ?

Ans: Follow the beneath steps to boot RHEL / Rocky Linux / CentOS in single user mode:

  • Reboot and go to the grub prompt
  • Go to the end of line which starts with ‘linux’ and type ‘rd.break’ and hit enter.
  • Mount the root file system in rw mode and then do chroot /sysroot.
  • Perform the the troubleshooting.

Q:11 How to share a directory using nfs ?

Ans: To share a directory using nfs ,

  • First edit the configuration file ‘/etc/exportfs’ , add a entry like
  • /<directory-name>  <ip or Network>(Options)
  • Restart the nfs service or ‘exportfs -arv’

Q:12 How to check and mount nfs share ?

Ans:  With showmount command we can see which directories are shared via nfs e.g ‘showmount -e <ip address of nfs server>’. Using mount command we can mount the nfs share on linux machine.

Q:13 What are the default ports used for SMTP,DNS,FTP,DHCP,SSH and squid ?

Ans: Default ports are listed below:

  • Service      Port
  • SMTP          25
  • DNS            53
  • FTP             20 (data transfer) , 21 ( Connection established)
  • DHCP         67/UDP(dhcp server) , 68/UDP(dhcp client)
  • SSH            22
  • Squid         3128

Q:14 What is Network Bonding ?

Ans: Network bonding is the aggregation of multiple lan cards into a single bonded interface to provide fault tolerance and high performance. Network bonding is also known as NIC Teaming.

Q:15 What  are the different modes of Network bonding in Linux ?

Ans: Below are the list of modes used in network bonding :

  • balance-rr or 0 – round-robin mode for fault tolerance and load balancing.
  • active-backup or 1 – Sets active-backup mode for fault tolerance.
  • balance-xor or 2 – Sets an XOR (exclusive-or) mode for fault tolerance and load balancing.
  • broadcast or 3 – Sets a broadcast mode for fault tolerance. All transmissions are sent on all slave interfaces.
  • 802.3ad or 4  – Sets an IEEE 802.3ad dynamic link aggregation mode. Creates aggregation groups that share the same speed & duplex settings.
  • balance-tlb or 5 –  Sets a Transmit Load Balancing (TLB) mode for fault tolerance & load balancing.
  • balance-alb or 6 –  Sets an Active Load Balancing (ALB) mode for fault tolerance & load balancing.

Q:16 How to check and verify the status the bond interface.

Ans: The file /proc/net/bonding/bond0 (replace the bond0 with the actual bond name) contains all details of the bond interface. The interface name may vary based on the setup. This file provides information about the enabled bonding mode and the network interfaces (LAN cards) used in the bond.

Q:17 How to check default route and routing table ?

Ans: Commands ‘netstat -nr’, ‘ip route show’ and ‘route -n’ will show the default route ( or gateway) and routing tables.

Q:18 a)How do you check open ports on a Linux system?

Ans:  With the help of the ss, netstat –listen, and lsof -i commands, we can check the status of listening ports.

b) How do you change file permissions in Linux?

Ans: Using chmod command, we change file permissions, example

$ chmod 755 file.txt

c) What is the sticky bit in Linux, and why is it used?

Ans: It is special permission in Linux, Sticky bit generally set on directories to restrict file deletion. When applied, only the file owner, the directory owner, or the root user can delete or modify files within the directory, regardless of other permissions.

d) How do you identify a sticky bit on a directory?

Ans: Use the ls -ld <directory_name> command. A sticky bit is represented by a t in the permission string (e.g., drwxrwxrwt).

Q:19 What is default data directory for docker containers ?

Ans: Default data directory for docker containers are ‘/var/lib/docker’

Q:20 What is the main difference between Docker and Podman ?

Ans: Docker is a daemon-based process, meaning containers will only function when the Docker daemon is running. In contrast, Podman is daemon-less, allowing containers to run without relying on a daemon.

Also ReadHow to Create Hard and Soft (symlink) Links on Linux Systems

Q:21 How to upgrade Kernel in Linux ?

Ans: It is recommended to avoid upgrading the Linux kernel directly. Instead, always install a new kernel using the dnf, yum, or rpm command. Upgrading the kernel can potentially render your Linux system unbootable.

Q:22 How To scan newly assigned luns on linux box without rebooting ?

Ans: There are two ways to scan newly assigned luns :
Method:1 if sg3 rpm is installed , then run the command ‘rescan-scsi-bus.sh’
Method:2 Run the Command ,  echo ” – – – ” > /sys/class/scsi_host/hostX/scan

Q:23 How  to find WWN numbers of HBA cards in Linux Server ?

Ans: We can find the WWN numbers of HBA cards using the command ‘systool -c fc_host -v | grep port_name

Q:24 a)How to add and change the Kernel parameters ?

Ans: To set the kernel parameters in linux , first edit the file ‘/etc/sysctl.conf’ after making the changes save the file and run the command ‘sysctl -p’ , this command will make the changes permanently without rebooting the machine.

b) How do you schedule tasks in Linux?

Ans: In Linux, tasks can be scheduled using

  • cron for recurring tasks.
  • at for one-time tasks.

Q:25 How to debug a shell script line-by-line ?

Ans:We can debug a shell script line by line by either executing the script with the -x option, like bash -x script.sh, or by adding set -x at the beginning of the script.

Q:26 How do you troubleshoot network issues?

Ans: On a Linux system, we can following key commands to troubleshoot network issues.

  • ping: Check connectivity.
  • traceroute: Trace the route of packets.
  • ifconfig or ip: Check network interface details.

Q:27 What is difference between SUID and SGID in Linux?

Ans: These are the special permissions in linux along with sticky bit.

  • SUID (Set User ID):
    When set, a file executes with the permissions of its owner, not the user running it.

    • Example: The passwd command runs with root privileges regardless of the user’s ID.
  • SGID (Set Group ID):
    When set, a file executes with the group permissions of its owner, or files in a directory inherit the group.

    • Example: A shared directory with SGID ensures all files inherit its group ownership.

Q:28 a)  How and Where to use Ansible ad-hoc commands ?

Ans: Ansible Ad-hoc commands are ideal for performing quick tasks or tests without the need to write a playbook.

To use an Ansible ad-hoc command, follow this syntax:

ansible [pattern] -m [module] -a "<module options>"
ansible webservers -m shell -a "df -Th"

b) How to Debug an Ansible Playbook?

Ans: You can use the -v, -vv, -vvv, or -vvvv options for increasing verbosity to view detailed output. Additionally, the --check flag simulates the playbook run without making any changes.

ansible-playbook -vvvv playbook.yml

Q:29 a) How to find all the files under /var whose size is more than 200 MB ?

Ans: With the help of find command we can list all the files whose size is more than 200 MB,

$ sudo find /var -type f -size +100M -exec ls -lah {} \;

b) How to find 30 days old files in /var and redirect them a file ?

Ans: Use the find command to find 30 days old file,

$ find /var  -type f -mtime +30 -exec ls -lah {} \; > /tmp/a.tmp

Q:30 How do you monitor system performance?

Ans: We can monitor the system performance using the following tools.

  • top
  • htop
  • vmstat
  • iostat

Read Also: Top 25 Shell Scripting Interview Questions and Answers

40 thoughts on “Top 30 Linux System Admin Interview Questions And Answers”

  1. Hello all,

    Please help me in the below question,

    I have to set a cronjob which will run daily at 12AM, all input and output errors will redirect to /dev/null.

  2. Hello,
    Thank you for these interview questions and answer….This is really very helpful ..Please provide interview question on AWS as I am preparing for interview. I used to prefer your blog since long time for keeping me updates..looking forward for new blogs..
    ALL THE BEST

  3. Thanks for your profetional explainations.
    If one want’s to become a Linux System Admin, is it a must to learn Puppet ?
    What are the “must subjects”, you recommand to learn for a junior ?
    THANK YOU

    1. not actually required anything for junior, but scripting will helpful to perform an automated task or schedule task automated

Leave a Comment

Your email address will not be published. Required fields are marked *