Red Hat Linux Interview
Red Hat Linux Interview
Q:1 What will happen when you execute the command “mv *” in your current directory ?
Ans : It will move all the contents of directory to the directory which is created in the last in your current
working directory, In Case if a file is created in last then it will through an error.
Q:2 Tell me the main difference between SCP and Telnet command ?
Ans : In Case of SCP data is transferred in an encrypted form between the client and server but in the telnet
data is transferred in plain text. Intruder can easily extract the confidential info in case of telnet.
Ans : RAID Stands for Redundancy Array inexpensive Disk, it is required to provide high availability and
redundancy in case of hard disk failure in physical servers.
Q:4 How to check when was the particular rpm installed on your server ?
eg
Ans : Using lsof command we find number of files associated to particular user.
# lsof -u apache
# lsof -u apache | wc -l
Q:6 How to check what is your current working shell ?
Ans : Yes, it is possible with option “–test” with rpm command like
this command will not install rpm package but it will check whether rpm installation will be successful or not.
Q:8 How to check whether a local linux user account is locked or not ?
Ans : Using the passwd command “passwd -S <user_name>” we can check whether the password is set or not.
Moreover we can also see the login failed attempts using “pam_tally2 -u {user_name}“. If login failed attempts
cross the limit then account will be locked.
Q:9 How to check when was the password changed for local Linux user ?
Ans : Use the chage command “chage -l {user_name}“, there is entry in the output “Last password change”
from there we can check the date.
User Name
Password
UID
GID
Shell
Ans : “8e” is the toggle id in fdisk command for Linux LVM partition.
Q:12 How to find access and modify time of a file and directory in linux ?
Ans : Using the ‘stat’ command we can find the access and modify time of a file and directory. Example is
shown below :
# stat {file_name}
# stat {Directory_name}
Q:13 List all the files of /var file system which are not accessed more than 30 days ?
Ans : Use the find command to list all files which are not accessed more than 30 days in /var.
Ans : In Case of RHEL 4 & 5 , we can use ‘mkinitrd‘ command to recreate initrd file. In RHEL 6 & 7 ‘dracut’
command is used to rebuild initrd file.
Ans : Use ‘-i’ option in df command to view the inode of the file system, Example “df -i /var”
Q:16 How to increase of ‘number of open files’ limit for a particular user in Linux ?
Ans : ‘Number of open files’ limit for a particular user can be increased by modifying the file
“/etc/security/limits.conf”. Add the following line in the file.
Q:17 How you will find the default ulimit values for a user in Linux ?
Ans : To check the default ulimit values of local user, first login to system with that user name and type the
command “ulimit -a”.
Ans : There are two ways to send mail from the terminal
telnet command
Ans : We can set the proxy settings on Linux terminal using the variables like http_proxy, https_proxy and
ftp_proxy.
# export http_proxy=http://<ip_or_dns_name_of_proxy_server>:<port_no>
# export https_proxy=http://<ip_or_dns_name_of_proxy_server>:<port_no>
# export ftp_proxy=http://<ip_or_dns_name_of_proxy_server>:<port_no>
Q:20 Find all files under /opt which has 777 permissions and change it to 644.
Ans : Use the following command to get linux flavor and version :
# cat /etc/*-release
Q:22 What is the uid and gid of root user on Linux server ?
Ans : There are two main configuration files of postfix mail server.
/etc/postfix/main.cf
/etc/postfix/master.cf
Ans: Command “swapoff -a” is used to disable swap memory and “swapon -a” is used to enable swap memory
on linux servers.
Q:26 What is default port of proxy server(Squid), SMTP, Apache Web Server(httpd) and MariaDB Database Server ?
Q:28 How you will check ip address and routing table of a linux box ?
Ans : Using the commands ‘ifconfig’ and ‘ip address‘ we can view the ip address of a linux server. With the
commands like ‘netstat -nr’ and ‘route -n‘ we can view the current routing table.
Q:29 Tell me the default configuration file of linux ftp server (vsftp ) ?
Q:30 How to merge the contents of two files into a single file from the command line ?
Ans: With the help of cat command we can merge the contents of two or more files into a single file.
Q:31 Which command is used to check the permissions of a file and directory ?
Ans : “ls -l {path_file_name}” is used to check the permissions of a file. “ls -ld {path_directory_name}” is used
to check the permissions of a folder or directory.
Ans : mtab file keeps the information of all the current mounted file system only.
Ans: There is no way to recover the root password, the only way is to reset the root password from single user
mode.
Q:34 What can be the reasons that Oracle user is unable to run its cron jobs ?
* * * * * {Command_to_be_executed}
(minute) {hour} {day_of_month} {month} {day_of_week}
Q:36 Tell me the log file for cron jobs in linux server ?
Ans : All the cron job’s logs are stored in its log file “/var/log/cron”
Q:37 what will happen if i run the command ” kill -9 1″ ?
Q:38 What is default home directory of ftp user and how to change it ?
Ans: “/var/ftp” is the default home directory of ftp user. It can be changed using the usermod command like
“usermod -d /{path_new_directory} ftp“.
Ans : Partitions can be created on raw disk either by using ‘fdisk’ command or by ‘parted’ command
Q:40 How to copy the files and directory from one Linux server to another remote Linux server ?
Ans :
With help of ‘scp‘ and ‘rsync‘ command we can copy the files of one linux server to another. Syntax of scp and
rsync is shown below :