Q:1 What is Kdump and why it is required ?
Ans: Kdump is a mechanism to capture crash dumps when the system crash or kernel panic occur. Crash dumps can be stored either on remote file system or on local file system.By analyzing the crash dumps we can find the root cause of system failure or kernel panic. In case if you OS vendor support then you can share the vmcore file with the vendor for further analysis.
Q:2 How to check when was the file system scan last time ?
Ans: With help of tune2fs command we can check when was the file system scan for errors.
# tune2fs -l <Device_Name> | grep “Last checked”
Q:3 How to change Password expiry date of a account without changing its password ?
Ans: With help of chage command we can extend the password expiry date of a local account. Syntax is show below
# chage -d <date-in-yy-mm-dd> <User_Name>
Q:4 How to run fsck forcefully on a OS file system on next reboot ?
Ans: To run fsck forcefully on a particular file system on next reboot, create a empty file with name ‘forcefsck’ in the file system . Let’s assume we want to run fsck on /home file system on next reboot.
# cd /home ; touch forcefsck ; reboot
Q:5 Which tool is used to analyze crash dump or vmcore file on CentOS 7 & RHEL 7 ?
Ans: crash is the utility or command on CentOS 7 and RHEL 7 through we can analyze crash dumps.
Q:6 How to install all the patches except kernel on CentOS and RHEL ?
Ans: Using the ‘–exclude=kernel*’ parameter in the yum command we can install all patches except kernel. Example is shown below
# yum update –exclude=kernel*
Add the below entry in the file ‘/etc/yum.conf’ to prevent updating kernel permanently.
Q:7 How to check whether you are working on Physical or Virtual Server ?
Ans:Use below dmidecode command to check whether your are working on Physical or virtual server.
# dmidecode -t system | grep “Product Name”
Product Name: VMware Virtual Platform
Q:8 What is automounter and why it is required ?
Ans: Automounter is a service in Linux like operating system which is used to mount remote file system or local file system automatically whenever it is access. When the file system is inactive for a particular period of time then automounter service (autofs) will automatically umount the file system. The main benefit of autofs is that the system don’t need to mount the file system all the time, it will only mount the file system whenever it is in demand.
Q:9 How to force a user to change its password at the login ?
Ans: Use ‘chage‘ command to expire the user’s password , like “chage -d 0 <user_name>“, After this whenever user tries to login or ssh the system, he/she will get the waring message” Your password has expired. You must change your password now and login again”
Q:10 How to check whether the last command that you run is executed successfully or not ?
Ans : By knowing the exit status of special variable ‘$?‘ we can tell whether the last command that we run is executed successfully or not. Example is shown below:
# ls -l /var/
# echo $?
# ls -l /var/wwer
# echo $?
Exit status zero means last command was executed successfully, exit status other than zero means unsuccessfull.
Q:11 How to check when was the particular rpm package installed ?
Ans: Let’s take an example of postfix. Use below rpm command to find when was postfix rpm installed.
We can also use yum command to find above requested info.
[[email protected] ~]# yum history package postfix
Q:12 How to Login single user mode in RHEL 7 ?
Ans: Boot the system , go to GRUB2 boot loader Screen, Press ‘e’ and go to the line which starts with ‘linux16/vmlinz‘ and replace ‘ro‘ with ‘rw init=/sysroot/bin/bash‘ and Press ctrl-x to boot.
Q:13 Which Command is used to set hostname permanently on CentOS 7 & RHEL 7 ?
Ans: ‘hostnamectl‘ command is used to set or configure hostname permanently. Example is shown below
# hostnamectl set-hostname “New_HostName”
Apart from hostnamectl command ‘nmtui‘& ‘nmcli‘ are also used to set hostname in CentOS 7 and RHEL 7.
Q:14 How to enable password policies in Linux ?
Ans: Password policies can be enabled using pam(pluggable authentication module). In Centos and RHEL we have “/etc/pam.d/system-auth” file where we define the password policies as per the requirement. In Debian based OS we have “/etc/pam.d/common-password” file
Q:15 How to check which Kernel Modules are installed on your Linux box ?
Ans: ‘lsmod‘ command will give us the list of installed kernel modules.
Q:16 which command is used to check IO Stat in Linux ?
Ans:There are couple of command like ‘sar‘, ‘iostat‘ and ‘vmstat‘ through which we can check io stat in Linux.
Q:17 What is the use of ‘/etc/lvm/backup’ and ‘/etc/lvm/archive’ ?
Ans: When we create and update any lvm based partitions then metadata backup is stored in the file ‘/etc/lvm/backup‘ and archive meta data is kept in ‘/etc/lvm/archive‘ file. Using vgcfgrestore command we can restore the Volume group meta data.
Q:18 How to list the routing table of your Linux box ?
Ans: Using the commands ‘route -n‘ and ‘netstat -nr‘ we can list the current routing table in Linux.
Q:19 What happen in the background when you ssh a server from your Linux machine ?
Ans: Whenever we ssh any unix server then TCP connection is formed from Client to Server on 22 port by default and Server give the SSH protocol version it supports. If the client accepts the SSH protocol version then the connection continues and after that server provides its host public key and client keeps that key in file ‘~/.ssh/known_hosts‘ and then finally we get ssh prompt.
Q:20 How to change the default SSH port of your Linux Server ?
Ans: Default port (22) of SSH can be changed by updating the parameter “Port <NNN>” in the file ‘/etc/ssh/sshd_config‘. Where NNN is port number. After making the changes either restart or reload ssh service.
Q:21 How to see timestamps in dmesg on RHEL7 ?
Ans: Using the command ‘dmesg -T‘ we can view the timestamps in dmesg.
Q:22 How to check make and Model of physical Server from Command line ?
Ans With help of dmidecode command we can find make and model of physical server, example is shown below
# dmidecode -t system ........................ Handle 0x0011, DMI type 1, 27 bytes System Information Manufacturer: HP Product Name: ProLiant DL580 Gen8 Version: P79 Serial Number: CKX42926E0 UUID: 97387735-1541-238A-1B33-533850564430 Wake-up Type: Power Switch SKU Number: 728551-B21 Family: ProLiant ...............................................
Q:23 How to check BIOS version of your server from command line ?
Ans: With help of dmidecode command we find bios version from the command line
# dmidecode -t bios # dmidecode 2.12 SMBIOS 2.8 present. Handle 0x0010, DMI type 0, 24 bytes BIOS Information Vendor: HP Version: P79 Release Date: 04/01/2014 Address: 0xF0000 Runtime Size: 64 kB ROM Size: 16384 kB .............................
Q:24 How to extend the existing volume group ?
Ans: First create a pv(physical volume) on new raw disk ( /dev/sdb) using command “pvcreate /dev/sdb” and then use vgextend command “vgextend <vloume_group_name> /dev/sdb”
Q:25 How to view WWN number of HBA card on Linux servers ?
Ans: There are two ways through which we can view WWN number of HBA Card.
First Way using the systool command like :
# systool -c fc_host -v | grep “port_name”
Second Way is using sys class files :
# cat /sys/class/fc_host/host*/port_name