Most Importa NT Interview Question Linux
Most Importa NT Interview Question Linux
LINUX
INTERVIEW PREPARATION QUESTIONS
1. Do you configure DHCP. And why?
ANS. Yes , DHCP stands for Dynamic Host Configuration Protocol . DHCP is a network
protocol that enables the server to assign an IP addresses to the clients in the network
automatically from a defined range of IP addresses.
2. How to configure the DHCP server?
ANS. # yum install dhcp* -y
# vim /etc/dhcp/dhcpd.conf
Go to line number 47 Go to line number 47 and edit that line as below. subnet
netmask { range ; default-lease-time 600; (the minimum lease time to the client in
seconds) max-lease-time 7200; (he maximum lease time to the client in seconds) }
Example : subnet 172.25.0.0 netmask 255.255.255.0 { range 172.25.9.50 172.25.9.100;
default-lease-time 600; max-lease-time 7200.:
* Go to line number 51 and edit that as below. option routes ; option broadcast-
address
Example : option routes 172.25.9.11; option broadcast-address 172.25.9.255
Wq!
systemctl restart dhcpd
3. What is DORA Process?
Monitor key metrics such as CPU usage, memory usage, disk space, network
activity, and application-specific metrics.
12.How many virtual servers and Physical server?
There are 600 virtual server and 120 physical server .
12. what is the benefit of LVM?
Ans. Dynamic volume resizing
Volume resizing and mirroring
Flexible allowcation of storage space
Snapshot
Online volume migration
Ease of volume management
Extensibilty
Improved backup and recovery.
Better space utilization
13. Do you trouble shoot any network related problem?
14. Do you face any network related problem of any Server?
15. Have you done Server hardening?
I have full theoretical knowledge about server hardening . like .
Server hardening is the process of securing a server by reducing its surface of
vulnerability. It involves configuring the server and its software to enhance security
and minimize potential risks
16. How many team members in your team?
77
17. what is RAID?
RAID stands for Redundant Array of Independent Disks. It provides fault tolerance,
load balancing using stripping, mirroring and parity concepts.
TWO TYPES OF RAID:-
(i) Hardware RAID (Depends on vendors and also more expensive)
(ii) Software RAID (Does not depends on vendors and less expensive when
compared to Hardware RAID and also it is maintained by system administrator
only
RSYNC SCP
PORT NO. 873 PORT NO. 22
Data transferred in Encrypted form Data transferred in Plain text
Don’t overcome data when backup Take overcome data
Show transferring data Don’t show transferring data
1 .Disk Space:
2.Review System Logs:
3.Network Issues:
4.Check for Rogue Processes
5.Evaluate Memory Usage
6.Check CPU Usage:
7.Check for Malware or Security Threats
8.Review Running Services:
9.Check Kernel Parameters:
10.Update Software:
11.Consider Resource Upgrades
12.Optimize Configuration Files:
22. How to Monitor Servers if your server is slow?
23. Explain the output of Top command.
PID: Process ID.
USER: User who owns the process.
PR: Priority of the process.
NI: Nice value.
VIRT: Virtual memory used by the process.
RES: Resident set size (non-swapped physical memory used).
SHR: Shared memory size.
S: Process status (running, sleeping, stopped, etc.).
%CPU: Percentage of CPU usage by the process.
%MEM: Percentage of memory usage by the process.
TIME+: Total CPU time consumed by the process.
6.Check for DNS Caching: 7. Check DNS Configuration Files: 8. Check System Logs:
A firewall is a security barrier between a computer network and the outside world. It can be
implemented in hardware, software, or a combination of both. It monitors and controls
incoming and outgoing network traffic based on predetermined security rules. It acts as a
gatekeeper, allowing or blocking traffic based on these rules. Firewalls are used to protect
computer systems and networks from unauthorized access, cyberattacks, and other security
threats by controlling the flow of traffic.
35. In how many ways we can protect the network?
1.FIRWALL
2.SELINUX
3.TCP WRAPPERS
4.NETWORK INTRUSION DETECTION SYSTEM {NIDS}
5.SSH SECURITY
6.VPN
ETC.
36. What are TCP wrappers?
TCP Wrappers allow you to control access to network services based on hostnames,
IP addresses, or network patterns. It is often used with services that support it, like sshd.
37. What is the difference between RHEL 6 & 7?
1.OS TIME RHEL6-40 SECOND RHEL7-20 SEC
2.MAXIMUM XIZE OF SINGLE PARTITION RHEL6- 50TB(EXT4) RHEL7-500TB(XFS)
3,BOOT LOADER RHEL6-/boot/grub/grub.conf RHEL7- /boot/grub2/grub.conf
4.PROCESSOR ARCHITECTURE RHEL6- IT support 32bit & 64 bit both RHEL7- it support only
64 bit
5. FORMAT & ASSIGN A FILE SYSTEM – RHEL6-#mkfs.ext4/dev/hda4
RHEL7-mkfs.xfs/dev/hda3
6. REPAIR FILESYSTEM – RHEL6 - #fsck –y/dev/hda3 RHEL7- #xfs_repair /dev/hda3
(i) First check which process and who executed that process is consuming more
CPU utilization or memory utilization by executing # top command.
(ii) Then inform to those users who executed that process though mail, message or
raising the ticket.
(iii) If those users are not available or not responding to our mail then we have to
change the priority of that process using # renice command.
(iv) Before changing the process priority level , we have to get or take approval from
our team lead or project manager
39. How to kill any process?
Kill-9 pid
40. How to repair the corrupted boot loader?
(i) Insert the RHEL - 6 DVD and make sure that system should boot from CD/DVD.
(ii) Boot the system in Rescue Installed System mode.
(iii) Select the language with which we want to continue and click on OK.
(iv) Select the Keyboard type as US and click OK.
(v) Select Local CD/DVD and click OK.
(vi) Move the cursor to NO to ignore the Networking.
(vii) Move the cursor to Continue tab to mount the root ( / ) from CD/DVD and press
Enter key.
(viii) Now the root ( / ) file system is mounted on /mnt/sysimage, here click on OK
and Press Enter to continue.
(ix) Select the "shell Start shell" option and click on OK, then shell will be displayed
on screen.
(x) At shell prompt type as # chroot /mnt/sysimage command, press Enter.
(xi) Check the /boot partition by # fdisk -l command
(xii) Install the new grub on the boot device ie., may be /dev/sda2 by # grub-install
command (For example # grub-install /dev/sda2).
(xiii) If it show no error reported that means we have successfully recovered the
grub.
(xiv) Then type # exit command and again type # exit or # reboot command to reboot
the system
41. How to change the run level temporarily?
Init (runlevel)
42. What is SWAP?
43. How to make any server password less?
SSH KEY GENERATION
44. What is the Linux file system?
a file system in Linux is like an organized way of storing and managing files on your
computer. TYPES- EXT4,EXT2,EXT3,XFS,B-TREE,ZFS,FALSH-FRIENDLY ,Virtual file allocation
table {VFAT} , new technology file system {ntfs}
TYPES OF FILE :- Regular file, Directory file, Link file, Character special file, Block special file,
Socket file, and Named pipe file
45. What is inode?
Identification of file , directory
46. what is the difference between ext2 and ext3 file system?
Ext2 Ext3
Stands for Second Extended file system Stands for Third Extended file system.
Does not having Journaling feature Supports Journaling feature
Max. file size can be from 16 GB to 2 TB. Max. file size can be from 16 GB to 2 TB.
Max. file system size can be from 2 TB to 32 TB Max. file system size can be from 2 TB to 32 TB
Cannot convert ext file system to ext2 We can directly convert ext2 to ext3 file system.
60. How to know how many UDP & TCP ports are open?
Check MySQL Service Stat , Review MySQL Error Log , Check Disk Space ,
Verify MySQL Configuration , Verify MySQL Port Availability , Restart MySQL , Examine
System Logs , Firewall Configuration , etc.
75. How to check security packages?
rpm -qa | grep -i security
76. How to check running port?
Netstat tunlp
77. How to take backup a mysql data base?
# MYSQL DUMP –U ROOT -P OIT.SHAN>OIT.SHANDUMP
78. What is Mysql port number?
3306
79. What is differential backup?
Taking a backup from last full backup or last cumulative or differential backup
80. What is incremental backup?
Taking a backup from the last full backup or last incremental backup
81. How many ways to take backup?
(i) Full backup (Entire file system backup)
(ii) Incremental backup (backup from the last full backup or incremental backup)
(iii) Cumulative or differential backup (backup from last full backup or cumulative
backup.
82. SSl Port number?
443
83. Pop port number?
110
84. What is smtp port number?
587 OR 25
85. What is Passive mode in ftp Server?
In Passive FTP connection, both command and data connections are established by
the client. In this the server acts as entirely passive, that's why it is called the Passive FTP. Here the
server listens for incoming requested connections from client through port 21 and the client also
initiates the data connection at port 20.
86. What is the partition I’d Swap & Lvm?
Lvm – 8e , swap – 82 , linux normal partition -83
87. How to check software raid or hardware raid configure?
Lsblk , blkid , mdadm , cat /proc/mdstat , cat/etc/fstab.
88. what is the difference between Pop & imap?
IMAP (Internet Message Access
Feature POP3 (Post Office Protocol) Protocol)
Protocol Type Retrieval Protocol Access Protocol
Downloads emails from the server to the Keeps emails on the server and allows
Usage client manipulation on server
Typically downloads emails to the client,
removing them from the server (by Keeps emails on the server (unless
Email Retention default) configured otherwise)
Offline mode: Messages are stored Online mode: Messages are stored on
Storage locally on the client the server
May lead to synchronization issues Well-suited for multiple devices,
Multiple Devices when accessing from multiple devices maintains synchronization
Stateless - Each session is independent Stateful - Maintains the state of
Connection of others emails and folders between sessions
IMAP (Internet Message Access
Feature POP3 (Post Office Protocol) Protocol)
Supports flags, read/unread status,
Message Flags Limited support for message flags and other metadata
Typically lower bandwidth usage as Higher bandwidth usage, especially
Bandwidth Usage emails are downloaded once for attachments and large emails
Requires more sophisticated server
Server Basic server functionality (send and capabilities for storage and
Requirements receive) management
Typically less secure, as messages are More secure, especially if using
Security downloaded and stored locally encrypted connections
Common Port
Numbers 110 (non-secure) or 995 (secure) 143 (non-secure) or 993 (secure)
106. What is the configuration file name of DNS and where is itlocated?
/etc/named.conf
107. How many new directories will be created after running thefollowing command
mkdir {a..c}{1..3}
9
108. Your PC is configured with a DNS server address but not thedefault gateway. Can
the PC access internet?
No
112. You are trying to ping a server by hostname and you get an errormessage, “ping:
unknown host …”. What could be the reason and how to solve the problem so you can ping it
by hostname?
Check for /etc/hosts or DNS to see if it has hostname to IP entry
112. Explain the difference between relative and absolute path? Absolute path starts from /
where relative path is your currentdirectory
121. What is the version of Redhat Linux you have experience with?
7.4
126. Where are the zone files located for DNS service?
/var/named/zonefiles
137. What is the difference between “kill” and “kill -9” command?
Aspect kill Command kill -9 Command
Sends a default signal (SIGTERM, Sends a forceful termination signal (SIGKILL, 9)
15) to the process, requesting it to to the process, forcing it to terminate
Signal Sent terminate gracefully. immediately.
Aspect kill Command kill -9 Command
Graceful Allows the process to perform Does not allow the process to perform any
Termination cleanup tasks before exiting. cleanup tasks; terminates abruptly.
Used for standard termination Used when a process is unresponsive or
Common requests, giving the process a refuses to terminate with a standard signal.
Usage chance to shut down gracefully. Provides a more aggressive termination.
Allows the process to catch and
handle the signal, providing an Does not allow the process to catch or handle
Effect on opportunity for cleanup or custom the signal; terminates the process forcefully
Process shutdown procedures. without any chance for cleanup.
Signal Signal number 15 (SIGTERM) is sent Signal number 9 (SIGKILL) is explicitly
Number by default. specified.
Example kill PID kill -9 PID
You can specify other signals with
Alternative the -s option, e.g., kill -s HUP Typically used when other signals do not work,
Signals PID for SIGHUP. and a forceful termination is required.
Used as a last resort when a process is
Suitable for normal termination unresponsive, stuck, or not terminating with
Usage scenarios where a process can other signals. Can lead to data loss or
Scenarios respond to the termination signal. corruption if used indiscriminately.
139. You are troubleshooting an issue with Redhat support and they have asked you to
send the contents of /etc directory. How andwhich method you will use to transfer the
contents?
tar (compress) the entire /etc directory and ftp
149. Which service/daemon should be running on the server that allowsyou to connect
remotely?
sshd
152. Which directory has all the commands we use, e.g. ls, cd etc.?
/usr/bin or /bin
153. What is the difference between memory, virtual memory and cache?
Aspect Memory Virtual Memory Cache
Logical extension of RAM Small-sized, high-speed
used when physical RAM is memory located close to the
Type Physical RAM insufficient. CPU.
Stores data and code Extends available memory Temporarily stores frequently
that is actively used by by using disk space as used data to speed up CPU
Purpose the CPU. temporary storage. access.
Slower access speed
compared to physical RAM Extremely fast access speed,
Access Speed Very fast access speed. due to disk involvement. faster than RAM.
Volatile (loses data May be persistent across
when power is turned reboots but slower due to Volatile (loses data when
Persistence off). disk access. power is turned off).
Limited by physical Larger capacity, limited by Smaller capacity compared to
Capacity RAM size. available disk space. RAM.
Managed by the Managed by the operating Managed by the CPU and
operating system's system, involves paging in hardware, transparent to the
Management memory manager. and out from disk. operating system.
Physically located on Partly resides on disk (swap Embedded on the CPU or
Location RAM modules. space) and partly in RAM. located very close to the CPU.
Active storage for Acts as a backup when Provides quick access to
running applications physical RAM is exhausted, frequently used instructions
Usage and the operating allowing more applications and data to enhance CPU
Scenario system. to run. performance.
RAM modules installed Swap space on the hard L1, L2, and L3 caches on the
Examples in the computer. drive or SSD. CPU.
159. Why is “tail –f logfilename” command used most often and whatdoes it do?
It will output all incoming logs in real time
167. What is the exact command syntax to list the 5th column of a fileand cut the first 3 letters?
cat filename | awk ‘{print $5}’ | cut –c1-3
169. List any 3 options of ‘df’ command and what they are used for?
Search online
174.There is a command which gives you information about other commands, please
explain that command and what is it used for?man
Free –m
181. What is inode and how to find an inode of a file?
Search online
185. You have scheduled a job using crontab but it does not run at thetime you specified,
what could be the reason and how would you troubleshoot?
Check your system time
Check your crontab entry
Check /var/log/messages
190. Which command is used to list the contents of a directory in themost recent time and
in reverse order, meaning the most updated file should be listed on the bottom?
ls –ltr
194. You noticed that one of the Linux servers has no disk space left,how would you
troubleshoot that issue?
If running LVM then add more disk and extend LVM
If not running LVM then add more disk, create a new partition andlink the new
partition to an existing filesystem
200. If a command hangs, how to stop it and get the prompt back?
Ctrl C
cal 2011
206. What is the command to send a message to everyone who is loggedinto the system?
wall
210. You get a call that when a user goes to www.yourwebsite.com itfails and gets an
error, how do you troubleshoot?
Check for user internet
Check to see if user computer has DNS for hostname lookup Check to see if the
server is up that is running that websiteCheck to see if the server’s web
service is running
Check for DNS availability which is resolving that website
226. What is the file name where user password information is saved?
/etc/shadow
227. Which command you would use to find the location of chmodcommand?
which chmod
234. You are notified that your server is down, list the steps youwill take to troubleshoot?
Check the system physically Login
through system consolePing the
system
Reboot or boot if possible
245. Which command(s) you would run if you need to find out how manyprocesses
are running on your system?
ps –ef | wc –l
249. What are a few commands you would run if your system is runningslow?
top, iostat, df –h, netstat etc.
253. Where is the network (Ethernet) file located, please provideexact directory location
and file name?
/etc/sysconfig/network-scripts/ifcfg-nic
256. To view your command history, which command is used and how torun a specific
command?
history and history #
257. What is NTP and briefly explain how does it work and where is theconfig files and
related commands of NTP?
Search online
263. Which file has DNS server information (e.g. DNS resolution)?
/etc/resolv.conf
264. What are the commands you would run if you need to find out theversion and build date
of a package (e.g. http)?
rpm –qi http
265. On the file permissions? What are the first 3 bits for and who isit for?
Read, write and execute. They are used for the owner of the file
271. What is the exact syntax of mounting NFS share on a client andalso how to un-mount?
Search online
275. You are tasked to examine a log file in order to find out why aparticular application
keep crashing. Log file is very lengthy,which command can you use to simplify the log search
using a search string?
grep for error, warning, failure etc. in /var/log/messages file
276. What is /etc/fstab file and explain each column of this file?
Search online
278. What is the exact command to list only the first 2 lines ofhistory output?
history | head -2
------r–x
282. What is CNAME record in DNS?
Entry for hostname to hostname
285. You get a call from a user saying that I cannot write to a file because it says,
permission denied. The file is owned by that user, how do you troubleshoot?
Give write permission on the first 3 bits
288. Which command syntax you can use to list only the 20th line of afile?
Search online
290. List a few commands that are used in troubleshooting networkrelated issue?
netstat, tcpdump etc.
292. You open up a file and it has 3000 lines and it scrolled up really fast, which command
you will use to view it one page at atime?
more or less
293. How to start a new shell. E.g. start a new ksh shell?
Simply type ksh, or bash
297. Which utility could you use to repair the corrupted file system?
fsck
299. How to combine 2 files into 1? E.g. you 3 lines in file “A” and 5lines in file “B”, which
command syntax to use that will combine into one file of 3+5 = 8 lines
cat fileA >> fileB
301.What does the following command do?echo This year the summer will be great >
file1 It will create a new file “file1” with the content as “This yearthe summer
will be great”
303. You need to modify httpd.conf file but you cannot find it, Whichcommand line tool you can
use to find file?
find / -name “httpd.conf”
304. Your system crashed and being restarted, but a message appears, indicating that
the operating system cannot be found. What is themost likely cause of the problem?
The /boot file is most likely corrupted
314. Client unable to login in server. What can you follow steps.
326. Kickstar
328. Top Command 1). Threshold value for load average. 2). Formula for calculating more
load avg. Througb nagios.
336. STICKYBIT.
339. What are the challenges you have faced and resolved on your own.
343. # When installing a server that uses LVM logical volumes, you’ll get at least
344. three storage volumes (partitions or LVM). Which of the following is not
346. # Which of the directories would typically not be mounted on its own
348. # Which tar option enables you to add one single file to a tar archive?
349. # Which directory would you go to if you were looking for configuration files?
350. # Which command enables you to rename the file myfile to yourfile?
351. # Which command enables you to wipe an entire directory structure, including
353. # How do you create a link to the directory /tmp in your home directory?
355. # Which command(s) show(s) all users that currently have a terminal session
357. # What is the name of the configuration file that needs to be edited to modify
359. # How do you copy the /etc/hosts file to the directory /tmp on server2 using the
username lisa?
360. # What is the name of the file in which public keys are stored for remote users
362. # Which command enables you to generate an SSH public/private key pair?