25 questions asked at an interview with Linux system administrators

    Translation by Andrey A. Porodko. Original by Pradeep Kumar March 21, 2016 ( http://www.linuxtechi.com/25-interview-questions-for-linux-administrator-job/ ).
    I hope someone comes 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 a similar question during an interview at RedHat, you will have the opportunity to prove yourself ;-)

    Question: 1 What is Kdump and what is it for?
    Answer:
    Kdump is a dump storage mechanism in the event of a system crash or kernel panic. Dumps can be saved both on a remote machine and on a local disk. By analyzing dumps, we can find the root cause of a 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:
    With the tune2fs command, we can check when the file system was last scanned for errors.
    # tune2fs -l| grep "Last checked"


    Question: 3 How to change the validity period of a user password without changing the password itself?
    Answer:
    The chage command allows you to set the date (expiration) of the password for the local user account. The command syntax is:
    # chage -d


    Question: 4 How to force fsck to 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 named 'forcefsck' in the root of this file system. For example, if we want to check the file system mounted in the / home directory, the command will look something like this:
    # cd / home; touch forcefsck; reboot


    Question: 5 What tool is used to analyze system crash dumps or a vmcore file in CentOS 7 & RHEL 7?
    Answer:
    Utility or crash command of CentOS 7 and RHEL 7 operating systems allows analysis of dump files.


    Question: 6 How to install all patches except kernel patches in 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, like this:
    # yum update –exclude = kernel *

    If we add the following line to the file '/etc/yum.conf' we will prevent any kernel updates forever:
    exclude = kernel *


    Question: 7 How to verify that you are working on a physical or virtual server?
    Answer:
    With the dmidecode command, we can test the server platform. For example, like this:
    # dmidecode -t system | grep "Product Name"
    Product Name: VMware Virtual Platform


    Question: 8 What is an automounter and what does it serve?
    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 the file system is inactive for a certain period of time, the automounter (autofs) service will automatically unmount it. The main benefit of autofs is that we do not have to mount the file system every time we need it, automounter will do this for us when accessing this file system.


    Question: 9 How to force the user to change the password during registration?
    Answer:
    The command 'chage' allows you to set the expiration time of the user password, for example, “chage -d 0 ". After that, when you try to register a user in the system (including via ssh), he will receive a warning “Your password has expired. You must change your password and log in again. "


    Question: 10 How do I know how the last team ended - successfully or not?
    Answer:
    You can get the completion status of the last command from the environment variable '$?', The completion code is stored in it. For example:
    # ls -l / var /
    # echo $?
    0
    # ls -l / var / wwer
    # echo $?
    2
    End code 0 means that the command completed successfully, any non-zero number indicates an error.


    Question: 11 How do I know if a specific rpm package is installed?
    Answer:
    Take postfix for example. The following use of the 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 to enter single user mode in RHEL 7?
    Answer:
    When the system boots, you need to go into the GRUB2 bootloader 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 loading.


    Question: 13 Which command allows you to change the host name permanently in CentOS 7 & RHEL 7?
    Answer:
    The command 'hostnamectl' is used to set or change the host name. For example, like this:
    # hostnamectl set-hostname "New_HostName"

    In addition to hostnamectl, the command 'nmtui' & 'nmcli' can also be used, which can also change the host name in CentOS 7 and RHEL 7.


    Question: 14 How to enable password policies in Linux?
    Answer:
    Password policies are enabled through pam (a subsystem of loadable authentication modules). In Centos and RHEL we have the file "/etc/pam.d/system-auth" in which we define the password requirements. In Debian-based operating systems, the file /etc/pam.d/common-password is used for the same purpose.


    Question: 15 How do I know which kernel modules are loaded on Linux?
    Answer:
    The 'lsmod' command lists the loaded kernel modules.


    Question: 16 What command can check the status of input-output in Linux?
    Answer:
    There are several commands, such as 'sar', 'iostat' and 'vmstat' using which we can check the status of I / O on 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, the metadata backup is saved in the file '/ etc / lvm / backup', and the metadata archive is kept in the file '/ etc / lvm / archive' file. Using the vgcfgrestore command we can restore the metadata of the lvm volume group.


    Question: 18 How to view the routing table in Linux?
    Answer:
    Using the commands 'route -n' and 'netstat -nr' we can view the routing table in Linux.


    Question: 19 What happens in the background when you go ssh to a Linux server?
    Answer:
    Each time 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, unless otherwise specified) and the Server issues a list of the SSH protocol version that it supports. If it “suits” the client, then the connection continues and after the Server sends its public key and the Client saves it in the file '~ / .ssh / known_hosts' we will get an ssh prompt.


    Question: 20 How to change the default port for SSH on Linux server?
    Answer:
    The default port value (22) for SSH can be changed in the “Port \"In the file '/ etc / ssh / sshd_config'. Where NNN is the port number. After making changes to this file, the SSH service should be restarted.


    Question: 21 How to see dmesg timestamps in RHEL7?
    Answer:
    Add the '-T' parameter to the dmesg command, you can see the dmesg timestamps.


    Question: 22 How to find out the physical server model 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 to expand an existing lvm volume group?
    Answer:
    First you need to create pv (physical volume) on an empty new disk (for example / dev / sdb) with the command “pvcreate / dev / sdb” and then, with the vgextend command, expand the group: “vgextend / dev / sdb ".


    Question: 25 How do I see the WWN number on an HBA card on a Linux server?
    Answer:
    There are at least two ways in which you can find out the WWN number for an HBA card.

    First, using the systool command. For example, like this:
    # 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

    Also popular now: