0% found this document useful (0 votes)
915 views19 pages

Linux System Administrator Interview Questions You'll Most Likely Be Asked

Linux System Administrator Interview Questions You’ll Most Likely Be Asked is a perfect companion to stand ahead above the rest in today’s competitive job market. Rather than going through comprehensive, textbook-sized reference guides, this book includes only the information required immediately for job search to build an IT career. This book puts the interviewee in the driver’s seat and helps them steer their way to impress the interviewer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
915 views19 pages

Linux System Administrator Interview Questions You'll Most Likely Be Asked

Linux System Administrator Interview Questions You’ll Most Likely Be Asked is a perfect companion to stand ahead above the rest in today’s competitive job market. Rather than going through comprehensive, textbook-sized reference guides, this book includes only the information required immediately for job search to build an IT career. This book puts the interviewee in the driver’s seat and helps them steer their way to impress the interviewer.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Job Interview Questions Series

LINUX SYSTEM
ADMINISTRATOR
INTERVIEW QUESTIONS
YOU'LL MOST LIKELY BE ASKED

296
Interview Questions
Linux System
Administrator
Interview Questions
You'll Most Likely Be Asked

© 2021, By Vibrant Publishers, USA. All rights reserved. No part of this


publication may be reproduced or distributed in any form or by any means,
or stored in a database or retrieval system, without the prior permission of
the publisher.

ISBN-10: 1-946383-15-5
ISBN-13: 978-1-946383-15-0

Library of Congress Control Number: 2011912660

This publication is designed to provide accurate and authoritative


information in regard to the subject matter covered. The author has made
every effort in the preparation of this book to ensure the accuracy of the
information. However, information in this book is sold without warranty
either expressed or implied. The Author or the Publisher will not be liable for
any damages caused or alleged to be caused either directly or indirectly by
this book.

Vibrant Publishers books are available at special quantity discount for sales
promotions, or for use in corporate training programs. For more information
please write to [email protected]

Please email feedback / corrections (technical, grammatical or spelling) to


[email protected]

To access the complete catalogue of Vibrant Publishers, visit


www.vibrantpublishers.com
Table of Contents

chapter 1 General Tools 7

chapter 2 Advanced Tools 17

chapter 3 Files Manipulation 25

chapter 4 Linux Understanding 29

chapter 5 Server Administration 41

chapter 6 Services & Daemons 57

chapter 7 Scripts 61

chapter 8 Administering and Upgrading


Kernel Modules 71

HR Interview Questions 79

Index 105
Dear Reader,

Thank you for purchasing Linux System Administrator Interview Questions You'll Most
Likely Be Asked. We are committed to publishing books that are content-rich, concise and
approachable enabling more readers to read and make the fullest use of them. We hope this
book provides the most enriching learning experience as you prepare for your interview.

Should you have any questions or suggestions, feel free to email us at


[email protected]

Thanks again for your purchase. Good luck with your interview!

– Vibrant Publishers Team

facebook.com/vibrantpublishers
Linux System
Administrator
Interview Questions
Review these typical interview questions and think about how you would
answer them. Read the answers listed; you will find best possible answers
along with strategies and suggestions.

www.vibrantpublishers.com
This page is intentionally left blank
Chapter 1

General Tools

1: You want to find all of the “.tmp” files in /home/* and delete
them, how can you do it in a command?
Answer:
First you need to find the files using find, then delete them using
rm- find /home/ -name ‘*.tmp’ | xargsrm –rf.

2: How can you add an “auto correction” that will automatically


fix “cd /homr” to “cd /home”?
Answer:
You can add the option cdspell to your shell options by typing
“shopt -s cdspell”.

www.vibrantpublishers.com
8 Linux System Administrator Interview Questions You’ll Most Likely Be Asked

3: How do you get additional information about a command -


for example get information about mail?
Answer:
If you want to learn about a command, you can use the commands
man mail or info mail to learn more about mail.

4: You are running a crontab command and don’t want the


command to send an output to the crontab service, how can you
handle it?
Answer:
You can send all of the output from the command (STDOUT AND
STDERR) to /dev/null - commandName 2>&1 >/dev/null.

5: How can you list the arp cache table of the current machine?
Answer:
You can use the command arp to control and view the arp table.

6: How can you eject your CDROM drive from the console?
Answer:
In order to eject the CDROM drive, you can use the command
eject.

7: You see a process “./myApplication” with PID 44556, how can


you know where was the file executed from?
Answer:
You can identify the path where the PID was executed by running
pwdx 44556 and you will get the command executing path as an
output.

facebook.com/vibrantpublishers
General Tools 9

8: You are doing an installation and want to record your


commands and outputs for later review, how can you do that?
Answer:
You can use the script application for this functionality - type script
-a mysession.log and it will start recording your terminal to
mysession.log, when you want to exit, type exit.

9: How can you get a view of the calendar of January 2004 on a


Linux console?
Answer:
You can get the view of month/year calendar with the command:
cal 01 2004.

10: You have 100 .txt files in a directory, you want to know in
which file you have the string “Error Found”, how can you do it?
Answer:
You will need to use the command “grep” in order to find data in
files - grep “Error Found” *.txt

11: What command is used to get the IP address(es) of the


domain name Google.com in Linux?
Answer:
In order to find the related IP Address(es) of the domain
google.com you can use “nslookup google.com”

12: What will be the outcome of the following command - touch


-m myFile?
Answer:
If the file exists, it will only change the modification time of the file,
www.vibrantpublishers.com
10 Linux System Administrator Interview Questions You’ll Most Likely Be Asked

if the file doesn’t exist, it will create it.

13: How will you create a tar file ‘MyTar.tar’ from the directory
‘MyTarFiles’ (which has many files)?
Answer:
A Tar file is the compressed format of collection of files, which
could be created with the following tar command:
tar -cfMyTar.tar MyTarFiles
In the above command
a) ‘MyTar.tar’ refers to the file name
b) ‘MyTarFiles’ refers to the directory or folder which contains
the list of files
c) –c will create an archive
d) f allows to specify the archive file name

14: How can you know, without checking the logs, which Kernel
version is currently loaded to the system?
Answer:
The uname tool allows you to get various system information - to
get only the kernel data, you can use uname –rsv.

15: What is the equivalent of “Norton commander” or “Windows


Commander”for Linux console?
Answer:
Linux provides the mc (Midnight Commander) tool to allow the
user to have an interactive interface for file management in Linux
Console.

facebook.com/vibrantpublishers
General Tools 11

16: How can you change a password of a different user (john),


when you have root access?
Answer:
Using the passwd command with the destination username -
passwd john

17: How do you make sure that your computer date & time are
always aligned?
Answer:
You need to connect your server to a ntp server using ntpd, or run
manually “ntptime ntpserver.com”

18: You have a tar file (myFile.tar), how do you convert it to a


gzip file on best compression?
Answer:
If you need to compress the file on a best compression, you need
to run the command “gzip -9 myFile.tar” and it will convert it to
myFile.tar.gz.

19: How can you disable eth1 during runtime?


Answer:
In order to disable a network card, for the current runtime, you
can run the command “ifdown eth1” or “ifconfig eth1 down”.

20: How can you get the current username that you are logged in
with?
Answer:
You can find the user that you are logged in with, using the

www.vibrantpublishers.com
12 Linux System Administrator Interview Questions You’ll Most Likely Be Asked

commands “who am I” or “whoami”.

21: Using the apt-get application, how can you install gcc
compiler?
Answer:
The apt-get allows you to download and install new applications
like gcc - apt-get install gcc

22: How do you run the internal “remote-desktop” VNC


application on Linux?
Answer:
In order to run the vncserver daemon and connect to the server
using a vncviewer on port 15000 + vnc instance number
(15001,15002).

23: How can you find all lines starting with the word “Error” in
the log file “mylog.log”, with a single command?
Answer:
The Linux command look allows you to find only lines beginning
with the provided string - look Error mylog.log

24: You have a file that you want to randomize its lines and
create permutations of it for distinctive file list, how can you
create a permutation of the file “myfile” into “mynewfile”?
Answer:
The Linux tool shuf allows you to create permutations of file and
shuffle the lines, which will allow you to create new distinctive
files - shufmyfile>mynewfile.

facebook.com/vibrantpublishers
General Tools 13

25: You have moved a file from one server to another, but you
are not sure that the file has been perfectly moved, how can you
verify that the file has not been corrupted?
Answer:
You can use the md5sum tool on both sides (both servers) on the
file and match the result, if it is the same, the file has not been
corrupted.

26: How would you copy the file “file.txt” owned by root using
secure ftp from 10.1.1.1 on /root/ to your local folder in one
command?
Answer:
You need to use the scp tool (secure copy over sftp) which allows
copying in one line [email protected]:/root/file.txt ./

27: How will you change all the ownership of /home/user1 to


user2 (recursively)?
Answer:
You need to use the chown command on the directory -
chownuser2:user2 /home/user1 –R.

28: How can you check how long is the system running since the
last restart and the load average on it?
Answer:
The uptime command can show you the current time, how long the
system has been running since the last restart, how many users are
currently logged on to the system, and the system load averages in
the resolution of the last 1, 5, and 15 minutes.

www.vibrantpublishers.com
14 Linux System Administrator Interview Questions You’ll Most Likely Be Asked

29: How can you check what processes a specified user (tom) is
currently running?
Answer:
ps command will output the current processes of all or specific
users - ps -U tom.

30: How can you see all the running processes at the system and
their resources use on a live auto-refreshing view?
Answer:
Top lets you see all the processes in the system and sort them by
resources usage.

31: What is the tool provided with gzip for decompression?


Answer:
The gzip tool provides another tool gunzip for gzip files
decompression.

32: You are waiting for a file to finish upload (newFile.tar.gz) by


a user to your directory and you know that the file size is 100M -
how can you sample the file every 5 seconds to see if it was
changed?
Answer:
You can monitor commands using “watch -n 5 ‘ls -shnewFile.tar.gz‘”
and it will give you the output of the command every 5 seconds.

33: How would you see the contents of a gzip compressed


contents without decompressing it first?
Answer:

facebook.com/vibrantpublishers
General Tools 15

Using zcat with the following command: zcat<filename>.gz


34: You have found a command on /bin/ that you don’t know
what it does, and you want a brief explanation about it, what do
you do in order to find it?
Answer:
You can find a command brief information using:
whatis<command>

35: What is the difference between locate and slocate?


Answer:
Unlike locate, which will search the updated results for the file,
slocate will look for files that the users have access to.

36: What does the command locate expecting in order to provide


successful results?
Answer:
The command locate relays on the database created by updatedb
and will provide results according to the last updated database.

37: How can you search for the word “FindMe” in all of the “.txt”
files in the current directory, recursively?
Answer:
Find . -name "*.txt" | xargsgrep "FindMe"

38: How can you send a message “Hello everyone” to everyone


who is currently connected to the system?
Answer:

www.vibrantpublishers.com
16 Linux System Administrator Interview Questions You’ll Most Likely Be Asked

If you want to send a message to all of the connected users, you


can use the command “wall Hello everyone”.
39: Create a crontab that will run once a day at 3am and write the
output of ls into /tmp/ls_result (truncate the file).
Answer:
a) Edit crontab: crontab -e
b) Add crontab line: 0 3 * * * /bin/ls> /tmp/ls_result
c) Save crontab.

40: How do you create a symbolic link between /bin/runme to the


new file /bin/runmetoo?
Answer:
You need to use the link tool “ln” in order to create links - ln -s
/bin/runme /bin/runmetoo.

facebook.com/vibrantpublishers
This page is intentionally left blank

You might also like