Linux Administration RedHat Interview Questions and Answers

Q1 : How to install Rpm Packages in Redhat & Centos Linux?
A : rpm and yum command are used to install packages in Redhat Linux and CentOS.

Q2 : How to check the Current Runlevel of a Linux Box?
A : ‘who -r’ and ‘runlevel’ , both of these commands are used to find the current run level.

Q3 : What is the Default Uid & Gid of Root User?
A : Default uid & gid of root user is 0.

Q4 : What is a Process?
A: Any program in execution is called a process.

Q5 : What are the Run Levels in Linux and How to change them?
A : A run level is a state of init and the whole system that defines what system services are operating and they are identified by numbers. There are 7 different run levels present (run level 0-6) in Linux system for the different purpose. The descriptions are given below.
0: Halt System (To shut down the system)
1: Single user mode
2: Basic multi-user mode without NFS
3: Full multi-user mode (text-based)
4: unused
5: Multi-user mode with Graphical User Interface
6: Reboot System
To change the run level, edit the file “/etc/inittab” and change initdefault entry ( id:5:initdefault:). If we want to change the run level on the fly, it can be done using ‘init’ command.
For example: when we type ‘init 3′ in the commandline, this will move the system from current run level to run level 3. Current level can be listed by typing the command ‘who -r’.

Q6 : What is the name of first process in Linux?
A : ‘init’ is the first process in Linux which is started by kernel and whose pid is 1.

Q7 : How to change the password of User from the Command Line?
A : ‘passwd <User-Name>’

Q8 : Why Linux is called Opensource?
A : Because One can customize the existing code and can redistribute it.

Q9 : What is Soft Link?
A : Soft link is a method to create shortcuts in Linux. It is similar to windows shortcut feature.

Q10 : What is Run Level 2?
A : Run level 2 is the multi-user mode without networking.

Q11 : Which command is used to check the Kernel Version?
A : ‘uname -r’

Q12 : What is the difference between Umask and Ulimit??
A : 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. While ulimit is a Linux built-in command which provides control over the resources available to the shell and/or to processes started by it.
You can limit user to specific range by editing /etc/security/limits.conf at the same time system-wide settings can be updated in /etc/sysctl.conf

Q13 : What is the functionality of a Puppet Server?
A : Puppet is an open-source and enterprise application for configuration management tool in UNIX like operating system. Puppet is an IT automation software used to push the configuration to its clients (puppet agents) using code. Puppet code can do a variety of tasks from installing new software, to check file permissions, or updating user accounts and lots of other tasks.

Q14 : What is Crontab and Explain the Fields in a Crontab?
A : The cron is a deamon that executes commands at specific dates and times in Linux. You can use this to schedule activities, either as one-time events or as recurring tasks. Crontab is the program used to install, deinstall or list the tables used to drive the cron daemon in a server. Each user can have their own crontab, and though these are files in /var/spool/cron/crontabs, they are not intended to be edited directly. Here are few of the command line options for crontab.
crontab -e Edit your crontab file.
crontab -l Show your crontab file.
crontab -r Remove your crontab file.
Traditional cron format consists of six fields separated by white spaces:
The format is explained in detail below.

* * * * * *

| | | | | |

| | | | | +– Year (range: 1900-3000)

| | | | +—- Day of the Week (range: 1-7, 1 standing for Monday)

| | | +—— Month of the Year (range: 1-12)

| | +——– Day of the Month (range: 1-31)

| +———- Hour (range: 0-23)

+———— Minute (range: 0-59)

Q15 : How to check all the Installed Kernel Modules?
A : Using the Command ‘lsmod’ we can see the installed kernel modules.

Q16 : How to list Hidden Files from the Command Line?
A : ‘ls -a’ <Folder_Name>

Q17 : What Initrd? 
A : Initrd stands for initial ram disk , which contains the temporary root filesystem and neccessary modules which helps in mounting the real root filesystem in read mode only.

Q18 : How to check the Default Gatway?
A : Using ‘route -n’ command we can determine the default gateway in Linux.

Q19 : How to check the Uptime of a Linux Server?
A : Using uptime command we can determine how long a Linux box has been running, also uptime can be viewed by the top & w command.

Q20 How to determine the Hostname of a Linux Box?
A : On typing the hostname command on terminal we can determine the hostname of a Linux server.