Translation by Andrei A. Porodko. Original by Pradeep Kumar · March 21, 2016 ( http://www.linuxtechi.com/25-interview-questions-for-linux-administrator-job/ ).I hope someone will come in handy. I was asked about ps, top and overcommitment in kvm ;-)Attention! Many letters and no pictures.From the translator. Please do not write in the comments that something can be done differently - this is a translation. When you are asked to interview a similar question at RedHat, you will have the opportunity to prove yourself ;-)Question: 1 What is Kdump and what is it for?
Answer:Kdump is a mechanism for saving dumps when a system crashes or a kernel panic. Dumps can be saved both on a remote machine and on a local disk. Analyzing the dumps, we can find the root cause of system failure or kernel panic. In case you have paid OS support, you can send the vmcore file to the supplier for further analysis.
Question: 2 How do I know when the file system was last checked?
Answer:Using the tune2fs command, we can check when the file system was last scanned for errors.
# tune2fs -l <Device_Name> | grep "Last checked"
Question: 3 How can I change the expiration date of a user password without changing the password itself?
Answer:The chage command allows you to set the date (expiration date) of the password for the local user account. The command syntax is:
# chage -d <date-in-yy-mm-dd> <User_Name>
')
Question: 4 How to make fsck check the OS file system at the next reboot?
Answer:To force the fsck utility to run to check a specific file system at the next reboot, you need to create an empty file with the name 'forcefsck' in the root of this file system. For example, if we want to check a file system mounted to the / home directory, the command would look something like this:
# cd / home; touch forcefsck; reboot
Question: 5 What tool analyzes system crash dumps or vmcore file in CentOS 7 & RHEL 7?
Answer:The utility or the crash command of the CentOS 7 and RHEL 7 operating systems allows you to analyze the dump files.
Question: 6 How to install all patches with the exception of kernel patches on CentOS and RHEL?
Answer:The '–exclude = kernel *' parameter of the yum command allows you to install all patches except those intended for the kernel. For example:
# yum update –exclude = kernel *
If we add the following line to the '/etc/yum.conf' file, we will prevent any kernel updates from happening forever:
exclude = kernel *
Question: 7 How to verify that you are working on a physical or virtual server?
Answer:Using the dmidecode command, we can check the server platform. For example:
# dmidecode -t system | grep "Product Name"
Product Name: VMware Virtual Platform
Question: 8 What is automounter and what is it for?
Answer:Automounter is a service in the Linux operating system that is used to mount a remote or local file system automatically when it is accessed. When a file system is inactive for a certain period of time, the automounter (autofs) service automatically unmounts it. The main benefit of autofs is that we don’t have to mount the file system every time we need it, automounter will do it for us when accessing this file system.
Question: 9 How to force the user to change the password during registration?
Answer:The 'chage' command allows you to set the user password expiration time, for example, “chage -d 0 <user_name>”. After that, when you try to register a user in the system (including ssh), he will receive a warning “Your password has expired. You must change your password and login again. ”
Question: 10 How to find out how the last command ended - successfully or not?
Answer:You can get the completion status of the last command from the environment variable '$?', It contains the completion code. For example:
# ls -l / var /
# echo $?
0
# ls -l / var / wwer
# echo $?
2
The completion code 0 means that the command was executed successfully, any non-zero number indicates an error.
Question: 11 How do I know if a particular rpm package is installed?
Answer:Take for example postfix. The following rpm command will show us whether postfix is installed or not:
[root @ cloud ~] # rpm -q postfix –last
postfix-2.10.1-6.el7.x86_64 Saturday 27 February 2016 11:56:43 PM EST
[root @ cloud ~] #
For the same purpose, we can use the yum command:
[root @ cloud ~] # yum history package postfix
Question: 12 How do I enter single user mode in RHEL 7?
Answer:When booting the system, enter the GRUB2 boot menu, press 'e', find the line starting with 'linux16 / vmlinz' and replace the 'ro' parameter with 'rw init = / sysroot / bin / bash'. Press ctrl-x to continue the download.
Question: 13 Which command allows you to change the host name permanently in CentOS 7 & RHEL 7?
Answer:The 'hostnamectl' command is used to set or change the host name. For example:
# hostnamectl set-hostname "New_HostName"
In addition to the hostnamectl, the 'nmtui' & 'nmcli' command can be used, which can also change the host name in CentOS 7 and RHEL 7.
Question: 14 How to enable password policies (password policies) in Linux?
Answer:Password policies are enabled through pam (loadable authentication module subsystem). In Centos and RHEL, we have the file "/etc/pam.d/system-auth", in which we define password requirements. In a Debian based OS, the file "/etc/pam.d/common-password" is used for the same purpose.
Question: 15 How do I know which kernel modules are loaded in Linux?
Answer:The 'lsmod' command lists the loaded kernel modules.
Question: 16 Which command can check the status of I / O in Linux?
Answer:There are several commands, such as 'sar', 'iostat' and 'vmstat' with which we can check the I / O status in Linux.
Question: 17 What is the purpose of the files '/ etc / lvm / backup' and '/ etc / lvm / archive'?
Answer:Each time we create or modify any lvm partition, a backup copy of the metadata is saved in the file '/ etc / lvm / backup', and the archive of metadata is kept in the file '/ etc / lvm / archive' file. Using the vgcfgrestore command, we can restore the lvm volume group metadata.
Question: 18 How to view the routing table in Linux?
Answer:Using the 'route -n' and 'netstat -nr' commands, we can view the routing table in Linux.
Question: 19 What happens in the background when you log in via ssh to a Linux server?
Answer:Every time when we log in via ssh to any Unix server, it establishes a TCP connection between the Client and the Server on port 22 (by default, if not specified otherwise) and the Server lists the version of the SSH protocol it supports. If the client is satisfied with the client, the connection continues and after the Server transfers its public key and the Client saves it in the file '~ / .ssh / known_hosts', we will receive an ssh prompt.
Question: 20 How to change the default port for SSH on a Linux server?
Answer:The default port value (22) for SSH can be changed in the “Port \ <NNN \>” parameter in the '/ etc / ssh / sshd_config' file. Where NNN is the port number. After making changes to this file, the SSH service should be restarted.
Question: 21 How to see the dmesg timestamps in RHEL7?
Answer:Adding the '-T' parameter to the dmesg command, you can see the dmesg timestamps.
Question: 22 How to find out the model of a physical server from the command line?
Answer:Using the dmidecode command, you can find out the manufacturer and model of the physical server. For example:
# 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
...
Question: 23 How to find out the BIOS version of the server from the command line?
Answer:Using the dmidecode command, you can get the bios version:
# 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
...
Question: 24 How can I extend the existing lvm volume group?
Answer:First you need to create a pv (physical volume) on an empty new disk (for example / dev / sdb) with the command “pvcreate / dev / sdb” and then with the command vgextend expand the group: “vgextend <vloume_group_name> / dev / sdb”.
Question: 25 How to view the WWN number on the HBA card on a Linux server?
Answer:There are at least two ways by which you can find out the WWN number for an HBA card.
First, using the systool command. For example:
# systool -c fc_host -v | grep "port_name"
The second way is to view the contents of the class file in the sys file system:
# cat / sys / class / fc_host / host * / port_name
0x7001639028cbeca0
0x7001639028cbefa2
0x7001639028cbf5d8
0x7001639028cbf6da