Linux Interview Questions.
Linux Interview Questions.
In some questions I am encouraging to search online because it will help you practice for
searching more complicated questions in the future
(Good Luck)
1. When you login you get “$” prompt, what is the prompt for root?
#
10. You are trying to ping a server by hostname and you get an error
message, “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
19. What is the version of Redhat Linux you have experience with?
7.4
24. Where are the zone files located for DNS service?
/var/named/zonefiles
35. What is the difference between “kill” and “kill -9” command?
Search online
37. You are troubleshooting an issue with Redhat support and they
have asked you to send the contents of /etc directory. How and
which method you will use to transfer the contents?
tar (compress) the entire /etc directory and ftp
50. Which directory has all the commands we use, e.g. ls, cd etc.?
/usr/bin or /bin
51. What is the difference between memory, virtual memory and cache?
Search online
57. Why is “tail –f logfilename” command used most often and what
does it do?
It will output all incoming logs in real time
65. What is the exact command syntax to list the 5th column of a file
and cut the first 3 letters?
cat filename | awk ‘{print $5}’ | cut –c1-3
83. You have scheduled a job using crontab but it does not run at the
time you specified, what could be the reason and how would you
troubleshoot?
Check your system time
Check your crontab entry
Check /var/log/messages
92. 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 and
link the new partition to an existing filesystem
96. How do you search for a pattern/word in a file and then replace
it in an entire file?
sed command
98. If a command hangs, how to stop it and get the prompt back?
Ctrl C
124. What is the file name where user password information is saved?
/etc/shadow
125. Which command you would use to find the location of chmod
command?
which chmod
132. You are notified that your server is down, list the steps you
will take to troubleshoot?
Check the system physically
Login through system console
Ping the system
Reboot or boot if possible
143. Which command(s) you would run if you need to find out how many
processes are running on your system?
ps –ef | wc –l
158. To view your command history, which command is used and how to
run a specific command?
history and history #
159. What is NTP and briefly explain how does it work and where is the
config files and related commands of NTP?
Search online
164. If you create a new group, which file does it get created in?
/etc/group
165. Which file has DNS server information (e.g. DNS resolution)?
/etc/resolv.conf
166. What are the commands you would run if you need to find out the
version and build date of a package (e.g. http)?
rpm –qi http
167. On the file permissions? What are the first 3 bits for and who is
it for?
Read, write and execute. They are used for the owner of the file
173. What is the exact syntax of mounting NFS share on a client and
also how to un-mount?
Search online
177. You are tasked to examine a log file in order to find out why a
particular 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
178. What is /etc/fstab file and explain each column of this file?
Search online
180. What is the exact command to list only the first 2 lines of
history output?
history | head -2
- - - - - - - r – x
184. What is CNAME record in DNS?
Entry for hostname to hostname
187. 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
190. Which command syntax you can use to list only the 20th line of a
file?
Search online
194. 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 a
time?
more or less
195. How to start a new shell. E.g. start a new ksh shell?
Simply type ksh, or bash
199. Which utility could you use to repair the corrupted file system?
fsck
201. How to combine 2 files into 1? E.g. you 3 lines in file “A” and 5
lines in file “B”, which command syntax to use that will combine
into one file of 3+5 = 8 lines
cat fileA >> fileB
205. You need to modify httpd.conf file but you cannot find it, Which
command line tool you can use to find file?
find / -name “httpd.conf”
206. Your system crashed and being restarted, but a message appears,
indicating that the operating system cannot be found. What is the
most likely cause of the problem?
The /boot file is most likely corrupted