Linux System Admin Interview Questions & Answers
In this article, we are going to discuss some Linux system admin interview questions with the answers for experienced professionals. Below mentioned questions may help you to clear Linux interviews.
See Also:
- LVM- LINUX INTERVIEW QUESTIONS
- SSH INTERVIEW QUESTIONS AND ANSWERS
- APACHE SOLR INTERVIEW QUESTIONS
- AWS INTERVIEW QUESTIONS
- MYSQL INTERVIEW QUESTIONS
- APACHE INTERVIEW QUESTIONS
Q:1 Why LVM is required?
Ans: LVM stands for Logical Volume Manager. It helps to resize the filesystem’s size online on Linux. Easily we can extend or reduce the size of LVM partition using the lvextend & lvreduce commands.
Q:2 How To check Memory stats and CPU stats?
Ans: By using ‘free’ & ‘vmstat’ command we can display the memory statistics physical and virtual both. Also with the help of ‘sar’ and ‘top’ command, we can display the CPU utilization.
Q:3 What does SAR provides and at which location Sar logs are stored?
Ans: System Activity Reporter (SAR) is an important tool that helps the system administrator to get a review of the server machine with the status of different critical metrics at different points of time. Using sar you can monitor the performance of different Linux subsystems (CPU, Memory, I/O..) in real time. The default log file location is /var/log/sa/.
Q:4 How to increase the size of the
Ans: With the help of mention steps you can increase the size of LVM partition:
–
– Resize the partition.
For CentOS/RHEL 6
resize2fs /dev/<Volume_group_name>/<Logical_volume_name>
For CentOS/RHEL 7
xfs_growfs /dev/<Volume_group_name>/<Logical_volume_name>
Q:5 How to reduce or shrink the size of the
Ans: With the help of mention steps you can reduce the size of LVM partition:
– Umount the filesystem using umount command.
# umount /<mounted point>
– Resize the partition
For CentOS/RHEL 6
# resize2fs /dev/<Volume_group_name>/<Logical_volume_name> 20G
For CentOS/RHEL 7
# xfs_growfs /dev/<Volume_group_name>/<Logical_volume_name> 20G
– Now reduce the filesystem using the lvreduce command.
# lvreduce -L 10G /dev/<Volume_group_name>/<Logical_volume_name>
Above Command will shrink the size & will make the filesystem size 20GB.
Q:6 How to create a partition from the raw disk?
Ans: There is default utility fdisk on Linux with the help of this utility we can create partitions. Below are the steps to create a partition from the raw disk :
– fdisk /dev/ for eq: [hd* (IDE) or sd* (SCSI)]
– Now press n and hit enter to create a new partition
– After creating a partition , press w and hit Enter to write the changes to the partition table.
Q:7 Where the kernel modules are located?
Ans: The default location of kernel modules is ‘/lib/modules/<kernel-version>/’. Also with ‘
Q:8 What is umask?
Ans:
Q:9 How to set the umask permanently for a user?
Ans: You can change your default umask value by changing the value in /etc/profile. If you want to set umask value for any specific user then you can change in ~/.bash_profile or ~/.bashrc file.
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 change the default run level in Linux?
Ans: You can change the run level using mention steps:
For CentOS/RHEL 6 –
– Edit /etc/inittab file to change the default run level.
# vim /etc/inittab
– Find below parameter and change the value
id:3:initdefault
Change to:
id:5:initdefault
For CentOS/RHEL 7
– Check the default run level using mention command.
# systemctl get-default
– Change the default run level.
# systemctl set-default TARGET.target
Q:11 How to share a directory using NFS?
Ans: To share a directory using NFS follow mention steps:
- First, you need to edit NFS the configuration file ‘/etc/exportfs’
- Add an entry like below.
/<directory-name> <IP or Network> (Options)’ - Restart the NFS service.
Q:12 How to check and mount NFS share?
Ans: You can use ‘showmount’ command to see what directories are shared via NFS. For eg. ‘showmount -e ‘
Q:13 What are the default ports used for SMTP, DNS, FTP, DHCP, SSH, and squid?
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 |
NFS | 2049/TCP & 2049/UDP |
HTTP | 80/TCP & 80/UDP & 80/SCTP |
Q:14 What is Network Bonding?
Ans: Network bonding is a process of combing or joining two or more network interfaces together into a single interface. Network bonding is also known as NIC Teaming.
Q:15 What are the different modes of Network bonding in Linux?
Ans: Below are list of modes used in Network Bonding :
mode=0 (balance-rr)
mode-1 (active-backup)
mode=2 (balance-xor)
mode=3 (broadcast)
mode=4 (802.3ad)
mode=5 (balance-tlb)
mode=6 (balance-alb)
Q:16 How to check and verify the status of the bond interface.
Ans: Use-mention command to check which the Network bonding interface. # cat /proc/net/bonding/bond0
With the help of the
Q:17 How to check the default route and routing table?
Ans: Use ‘netstat -nr’ and ‘route -n’ command to check the default route and routing tables.
Q:18 How to check which ports are listening in my Linux Server?
Ans: Use ‘netstat –listen’ and ‘lsof -i’ command to check listening ports.
Q:19 List the services that are enabled at a particular run level in Linux server?
Ans: We can using mention commands to list all the service that is enabled.
For CentOS/RHEL 6
#
For CentOS/RHEL 7
# systemctl list-unit-files
Q:20 How to enable a service at a particular run level?
Ans: We can enable a service using the mentioned command
For CentOS/RHEL 6
chkconfig –level 35 on
For CentOS/RHEL 7
# systemctl enable <service-name>
Q:21 How to upgrade Kernel in Linux?
Ans: We can’t upgrade Linux Kernel, we always install the new New kernel using rpm or yum command.
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 ‘systool -c fc_host -v | grep port_name’ command.
Q:24 How to add & change the Kernel parameters?
Ans: Edit /etc/sysctl.conf configuration file to set or change the kernel parameters in Linux and after making the changes run ‘sysctl -p’. We don’t need to reboot the service.
Q:25 What is Puppet Server?
Ans: Puppet is a configuration management tool that is used in deploying, configuring, managing, maintaining, a server machine. Puppet keeps the configuration of your hosts under check and can be used in one shot to configure a machine like installing package, editing and configuring, create and manage users required, etc. The main added advantage is that you can manage the configuration of almost all open-source tools available out there, using the puppet.
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:
In 2.X
#
In 3.X
#
Q:28 At which location Puppet Master Stores Certificates?
Ans: /var/lib/puppet/ssl/ca/signed
Q:29 How to find all the regular files in a directory?
Ans: Using find / -type f command.
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 server.
Enjoy it!