300 Interview Questions
300 Interview Questions
300 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?
#
5. How many new directories will be created after running the following command
mkdir {a..c}{1..3}
9
6. Your PC is configured with a DNS server address but not the default gateway. Can the PC access internet?
No
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
15. When you login you get a message on the screen. What is the name of that file and where is it located?
/etc/motd
16. What is /bin directory used for?
Search online
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
40. Your company has terminated a server administrator. What is first thing as an administrator you should do to
enhance the security?
Change root password
42. Which permission allows a user to run an executable with the permissions of the owner of that file?
First 3 bits should have x
47. Which service/daemon should be running on the server that allows you to connect remotely?
sshd
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
66. What is /etc/hosts file used for?
To resolve hostnames with IP address
67. List any 3 options of ‘df’ command and what they are used for?
Search online
72. There is a command which gives you information about other commands, please explain that command and
what is it used for?
man
88. Which command is used to list the contents of a directory in the most recent time and in reverse order,
meaning the most updated file should be listed on the bottom?
ls –ltr
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
99. Which command is used to count words or lines?
wc
104. What is the command to send a message to everyone who is logged into the system?
wall
108. You get a call that when a user goes to www.yourwebsite.com it fails 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 website
Check to see if the server’s web service is running
Check for DNS availability which is resolving that website
110. What is the output of the following command: $tail -10 filename | head -1
It will show the first line from the last 10 lines of a file
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
147. Which among the following interacts directly with system hardware?
a) Shell
b) Commands
c) Kernel
d) Applications
151. What are a few commands you would run if your system is running slow?
top, iostat, df –h, netstat etc.
155. Where is the network (Ethernet) file located, please provide exact directory location and file name?
/etc/sysconfig/network-scripts/ifcfg-nic
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
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
175. How to get information on all the packages installed on the system?
rpm –qa
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
181. How to upgrade Linux from 7.3 to 7.4?
yum install update
183. You have tried to “cd” into a directory but you have been denied. You are not the owner of that directory,
what permissions do you need and where?
-------r–x
186. What is the client name used to connect to ESXi or vCenter server?
vSphere client
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
192. List a few commands that are used in troubleshooting network related issue?
netstat, tcpdump etc.
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. 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
206. How would you troubleshoot a problem if the server goes down with no network in the middle of the night?
This is situational question so what is the best approach and what steps I would take to troubleshoot
First the server is physically accessible then I will go to the server and connect using a
keyboard/mouse and a monitor and try to login through console. If the server is not accessible
then I will try to reach the server through iDRAC if Dell or iLO if HP server. These console access
allow you to access the server even the OS is down. Also if the server is in a remote location then
most likely there are datacenter technicians who have access to the server and I will ask them to
connect to the server using keyboard/mouse and monitor and walk me through exactly what they
see on the screen.
207. How did you handle a difficult situation when you couldn't figure out what to do to fix a problem and user is
angry?
There might be situations when you have people breathing over your neck and get angry if they
server is down. The first thing I would do is not to panic and stay calm. Then I will ask the user to
please give me sometime so I can look into the issue and provide status update in an hour or so. I
will tell the user/customer that you are in good hands I will do everything to bring the system back
online asap. Then I will start troubleshooting the issue and if needed I will setup a conference call
with my team members to see if they can find something too. I will also reach out to for the vendor
support e.g. Redhat and ask them to open up a case and look into the issue asap. I will make sure
I provide continuous status every hour to my users and customers. Once the issue is resolved then
I would let the user know that I will definitely dig deep into the issue and find out what caused the
issue and most likely will provide root cause analysis for it.
208. What are the tools you've used to find the root cause of the problem and troubleshoot like say if this was due
to hardware failure, configuration of network gone wrong or compatibility issues? Where do you start to find
out what went wrong with server down?
top, /var/log/messages, free, dmesg, iostat, ifconfig, tcpdump, netstat
209. You need to modify httpd.conf file but you cannot find it, Which commandline tool you can use to find file?
find / -name "httpd.conf"
210. What is an OS and what are its functions? List few OSs on the commercial market.
Operating System is a software that manages the computer hardware and runs the programs
i.e. Window, Mac, Linux, Android
216. Why would you choose LINUX OS for your server to run apps?
More secure, and use less resources, free-open source and hardware support
217. What is Open-source Software? Give a few examples of open-source software which are industry standards
Free and available for anyone to to any changes, take it apart and put it together
Git-hub , Apache HTML, WordPress, Nagios, python, Kubernetes, dockers
218. What is closed source Software? Give examples of closed-source software Pay to use programs or software,
Windows os, mac os, adobe suite, Microsoft suite 365, final cut, autoCAD
219. What is the structure of Linux? Or What are the core parts of the Linux OS?
Hardware (hdd, ram, motherboard, cpu) – kernel (OS) – shell (interpretor) – application (terminal,
browser, zoom, virtual box)
224. How can you find out the kernel version of Linux system?
uname -r
227. What command do we use to get the commands you executed recently?
239. What is the command to check your username and ID of the user account?
id
241. What is the command to list all logged-in users and how long server has been up?
w
244. How can we get the ip address of local server and remote server?
nslookup
258. How we can long list files and sort by time stamp?
ls -lt | sort
259. How can we recursively show the contents of directory and subdirectory in the form of long list?
ls -lR
262. For a given directory structure /tmp/Users/data you are required to delete the user’s directory and
everything underneath it (recursively without getting prompted).
# rm -rf /tmp/User 1> /dev/null
269. How can we copy a file and directory while preserving the time stamp?
# cp -p
270. You got a file named /etc/hosts which was last modified about a week ago, you manager asks you to
update the time stamp on that file to the current. What command will accomplish this task?
# touch /etc/hosts
271. How to read 4 different files and redirect the output into one larger file?
# cat file1 file2 file3 file4 >> fileall
272. What is the difference between appending to a file VS overriding a file, and how to accomplish them?
>> for appending and > for overwrite, one > replaces the content while two >> appending will just
at the content under the last line of the file content
273. Say you ran a command, and it produced some “Permissions denied” error. You want to save the error
ONLY to a file called errors.txt. How would you accomplish this?
2> error.txt
277. What is head command and by default how many lines it show you?
Display the content of the file by the first 10 line (default)
290. What is the default umask value for a root user and a regular user?
0002
292. What is the numeric values that the system assigns to read, write and execute?
Read 4 write 2 execute 1
293. Can you tell me the command used for changing permissions of a file or directory?
chmod
294. What are different ways to change the permissions of a file or directory?
Numeric and symbolic
300. How can you quit vim with saving the changes you made?
Press shift + ; then type wq!
302. What are the different modes on Vim that you are familiar with? Name any five modes.
Command mode, visual mode, escape mode, insert mode, replace mode
303. Let’s say the word “NYC” appears in a file a hundred times and you want to replace it with “NJ” at
every place. What command with you use while you are inside a Vim editor?
Enter command mode ( shift+; ) and type %s/NYC/NJ/g and press enter this will replace
anything that has NYC will be replace with NJ
306. What command do you use to know how many user accounts exist on the system?
cat /etc/passwd
308. What are the slowest and fastest components of the system?
Ram the faster, hdd the slowest
309. Why do we need RAM if we have the hard disk for storage?
Ram helps for start processes faster that will be launch inside the storage drive
321. Name any three filesystems that you are familiar with.
Ext4 ext3 xfs ntfs FAT32, exFAT
324. How can you find the pattern “root | failed “ in the /var/log/secure file?
grep -E ‘root|failed’ /var/log/secure
325. How can we extract all the lines that contain the word “error|ERROR” in
/var/log/messages
grep -i error /var/log/secure
326. How can we obtain logs that pertain to sshd from Security log file/login logs.
grep sshd /var/log/secure