Top 30 Linux System Admin Interview Questions & Answers

In this article, we will discuss top 30 Linux system admin interview questions along with answers for experience professionals. Following questions may help the readers to clear Linux interviews. If you like these questions , please don’t hesitate to share on Facebook, Twitter and among your technical friends.

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

Q:1 Why LVM is required ?

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

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

Ans: Using ‘free’ & ‘vmstat’ command we can display the physical and virtual memory statistics respectively.With the help of sar command we can view the CPU utilization & other stats.

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

Ans: Sar collect, report, or save system activity information. The default version of the sar command (CPU utilization report) might be one of the first facilities the  user  runs  to  begin system  activity investigation, because it monitors major system resources. If CPU utilization is near 100 percent (user + nice + system), the workload sampled is CPU-bound.

By  default log files of sar command  is located at  /var/log/sa/sadd file, where the dd parameter indicates 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 or shrink the size of LVM partition ?

Ans: 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.

Note: In Production environment, it is not advise to reduce lvm partition as it may lead to data corruption.

 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: File ‘/proc/net/bonding/bond0’ contains all details of bond interface. Bond interface name may differ as per the setup. File contains which mode is enabled and which lan cards are used in this 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 How to check which ports are listening in my linux server ?

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

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, it means containers will only work when docker daemon is running whereas podman is daemon-less, it means containers don’t need any daemon to run.

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

Q:21 How to upgrade Kernel in Linux ?

Ans: We must never upgrade Linux Kernel , always install the new kernel using dnf (or yum) or rpm command because upgrading a kernel can make your linux system in an unbootable state.

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 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.

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

Ans: To debug a shell script, using ‘-x’ option in bash command followed by the script name. example is shown below,

$ bash -x script-name.sh

Q:26 What are manifests in Puppet ?

Ans: Manifests in Puppet are the files in which the client configuration is specified.

Q:27 Which Command is used to sign requested certificates in Puppet Server ?

Ans: ‘puppetca  –sign hostname-of-agent’ in (2.X)  & ‘puppet ca  sign hostname-of-agent’ in  (3.X)

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

Ans: Use the following syntax to use ansible ad-hoc command:

$ ansible [pattern] -m [module] -a <module option>
$ ansible webservers -m shell -a 'df -Th'

Ad hoc commands are used for performing quick tasks and tests. We don’t need to write any playbook to run ad-hoc commands on ansible hosts.

Q:29 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 {} \;

Additional question,

Q: 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 What is load average in Linux ?

Ans: Load  Average is defined as the average sum of the number of process waiting in the run queue and number of process currently executing over the period of 1,5 and 15  minutes. Using the ‘top‘ and ‘uptime’ command we find the load average of a Linux sever.

Read Also : How to Configure Chroot SFTP Server in Linux

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

  1. hi admin i will be much happy if you post some of real time roles and responsiblity of linux admin for freshers:-)
    in fact there is not doubt in your articles they are really helpful

    Reply
  2. hi admin its really good to study this article please keep moving live this ..
    & please post real time scenario .. i have few questions to ask
    1.if we what to mount a directory permanently in # /etc/fstab at last what it means “defaults 0 0”
    2. if i want to kill 20 or 30 process id [PID] at a time? what would be the cmd ? is that possible to like that
    3. i have created a user ‘hare’ and i have added to vi /etc/sudoers for giving root privileges, now can i able to acess /root home directory?? i want to read /root/projetc file? and i have added the file to a group “hello” & added a “hare”user to that group

    Reply
  3. Hi Ahmed ,

    Please find the answer of your queries below :

    1. Meaning of ‘defaults’ the fstab file : it will mount the file system with default mounting option like rw, suid, dev, exec, auto, nouser & async. First zero (0) after defaults is dump frequency ,if it is set to zero then the file system wouldn’t be dumped.
    Second Zero (0) after defaults shows fsck frequency , if it is set to 0 , then fsck will not check the file system for errors after corruption or improper shutdown.

    2. To kill a process of pid 20 or 30 , use the kill command like : # kill -9 20 ; kill -9 30

    3. To give root privileges to a user via sudoers , you need to add the user to group like sudo or wheel. After that user have to use sudo in front of every command to perform all the administrative task.

    Reply
  4. hi sir.. very useful interview questions.. no site is providing topic-wise interview questions .. so if u can provide them topic wise it will be very helpful for all.

    Reply
  5. I like your Linux interview questions..

    i have que.. if any one can help on this .

    1. i have schedule 1000 jobs at same time with cron, need to know if all will run at same time or they run one by one ..

    thanks you

    Reply
  6. Good stuff,

    Q11>>>Little error: the configuration file for NFS; /etc/exports not /etc/exportfs. the command to populate it is: exportfs

    Q19>>>chkconfig –list not chkconfig -list

    Overall: well presented. Keep sharing 🙂

    Reply
    • @Noor ahmed : there is no such single command to Kill 20-30 PID’s . You can either manually kill them or setup a small script..as below..

      lets suppose you have PID’s to Kill with you:
      $ for i in `cat`;do kill $i;done
      12
      13
      101
      99
      ….etc…

      Ctrl+d

      or if you want to kill all the process related to a particular service , like have an example of ssh service..you can do as below…

      $ pgrep sshd | while read p;do kill $p;done (it will kill all the process related to sshd in one go)

      Reply
  7. Hello Admin,
    How to configure to shutdown the server immediately once the normal user login the server? Is there any possibility to configure it? share me steps if it’s possible. I got this question from an interview.

    Reply
  8. Nice information sir can u please add the more question like whats your daily activity and two major issue resolved by you,boot process related issue like if error in grub config file what message come,if issue with initrd file and kernel file then when error message come…..thanks for the information

    Reply
  9. Very useful information sir, can you please send us VCS (Veritas Cluster Server) related question and answers, also add troubleshooting action on daily basis. it would be really great Thanks.

    Reply
  10. Nice set of questions. All of them are worth reading. I especially liked the ones covering the network and Puppet server part. Thanks.

    Reply
  11. Great, very useful, thanks.
    Just one thing about load average. This accounts also the processes in ‘uninterruptible sleep’ state.

    Reply
  12. 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.

    Reply
  13. 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

    Reply
  14. 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

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

      Reply

Leave a Reply to Pradeep Kumar Cancel reply