100+ Top Linux Theoretical Interview Exam Questions and Answers in 2022

Did you know that more than 80-90% of the World’s Fastest Computers use Linux? No doubt why! Linux is fast, powerful, and a techies’ favorite. If you are looking to become a Linux Administrator, then this is the right place for you to prepare for the interview.

Also Read: Top 77 Linux Interview Questions to Ask Candidates

As you all knows, Linux is an Open-Source OS based on Unix. Linux was first introduced by Linus Torvalds. The main purpose of Linux was to provide free and low-cost Operating System for users who could not afford Operating Systems like Windows or iOS or Unix.

The basic components of Linux are:

  • Kernel: It is the core component of the Operating System that manages operations and hardware.
  • Shell: Shell is a Linux interpreter which is used to execute commands.
  • GUI: GUI stands for Graphical User Interface which is another way for a user to interact with the system. But unlike CLI, GUI consists of Images, Buttons, TextBoxes for interaction.
  • System Utilities: These are the software functions that allows the user to manage the computer.
  • Application Programs: Software programs or set of functions designed to accomplish a specific task.

While some job interviewers take a fairly unusual approach to interview questions, most job interviews involve an exchange of common tech interview questions and answers. Here are some of the most common Linux theoretical interview questions, along with the best way to answer them.

Q1) What is the name of the Kernel configuration file?

Answer: config

Q2) What command with options and arguments will display the mail servers for techhyme.com?

Answer: dig techhyme.com mx
Alternative Answer: dig techhyme.com MX

Q3) Type the full path and name of the file whose global read bit you would change to deny normal users the ability to get useful information from the who and w commands.

Answer: /var/run/utmp

Q4) What file would you edit to make the current user’s vi session options always take effect? Type the full path and filename.

Answer: /.exrc

Q5) You boot a freshly installed system loaded with all the defaults, xdm loads and crashes, and the system halts. How can you force the system to multi-user text mode with networking from the LILO: or boot: prompt?

Answer: linux 3

Q6) What command with options will find all files on your system that have either the SUID or GUID bits set? Type the exact command with options to accomplish this.

Answer: find / -perm +6000

Q7) What is the file that contains the settings and conversion parameters for the ftp server? Type in the name of the file only.

Answer: ftpconversions

Q8) What is the preferred documentation tool of the FSF? Type in the name of the tool only.

Answer: info

Q9) What file or utility is used by normal users to configure the cron daemon? Type in the name of the tool only.

Answer: crontab

Q10) What file with full path is used to set the location to query for hostname resolution outside of the local system?

Answer: /etc/resolv.conf

Q11) To stop immediately a DDOS attack from 10.1.1.128, what can you do? Type the command with the necessary options and arguments.

Answer: route add 10.1.1.128 lo

Q12) With a Class C address, and a subnet mask of 255.255.255.0, how many host addresses are assignable?

Answer: 254

Q13) What command will most effectively track a network path problem?

Answer: traceroute

Q14) What command will load groups of modules into the kernel as needed?

Answer: modprobe

Q15) Which local system networking file binds a hostname to an IP address? Type the full path and name of the file.

Answer: /etc/hosts

Q16) What program will determine basic connectivity to a remote host? Type just the name of the program.

Answer: ping

Q17) What file on a remote host should be configured to allow your host to print to it’s already functioning printers? Type the full path and name of the file.

Answer: /etc/hosts.lpd

Q18) What file contains a list of shared directories on a Linux/Unix system? Type the full path and name of the file.

Answer: /etc/exports

Q19) To find the port used by a particular known service, you would look in what file? Type the full path and name of the file.

Answer: /etc/services

Q20) What command will flush all jobs on all print queues on a Linux system that uses the LPD daemon? Type the command with any options and arguments.

Answer: lprm -a all

Q21) Your IP address is 1.2.3.3. Which command would add a default gateway using the network 1.2.3.4?

Answer: route add default gw 1.2.3.4

Q22) What command would help you test if your ppp connection was functional? Type just the command name.

Answer: minicom

Q23) Where are command line aliases defined for a user? Type the full path and name of the file for the currently logged in user.

Answer: /.bashrc

Q24) What file do you configure to make changes to your smbd and nmbd daemons? Type the full path and name of the file.

Answer: /etc/smb.conf
Alternative Answer: /etc/samba/smb.conf

Q25) After modifying /etc/exports, what must be done to make the modifications available to users? Type the command with any options and arguments.

Answer: exportfs -a

Q26) To produce a compiled kernel with slightly better than standard compression, type the command with and any options and arguments to accomplish just the compilation.

Answer: make bzImage

Q27) What command will insert a single “!” symbol in from of the encrypted password in the system’s shadow file? Type the command with any options and arguments.

Answer: usermod -L
passwd -l

Q28) What is the exact, case-sensitive option that governs flow-control for the ppp daemon?

Answer: crtscts

Q29) What file is used to deny hosts access to a system’s printers? Type the filename including full path.

Answer: /etc/hosts.lpd

Q30) What command with switches allows you to set the defaults for the useradd command? Type the command with any options and arguments.

Answer: useradd -D

Q31) What file is used in recent apache distributions to configure the service? Type the full path and name of the file.

Answer: /etc/httpd.conf
Alternative Answer: /etc/httpd/httpd.conf

Q32) What commands with any options, will cause sendmail to recognize newly added aliases while it’s running?

Answer: sendmail -bi
Alternative Answer: newaliases

Q33) In what file can you configure your name server resolution queries to use the localhost first? Type the full path and name of the file.

Answer: /etc/nsswitch.conf

Q34) When you execute the “ls” command, you suspect an alias is set for the command, how can you just execute the command? Type the exact string that will accomplish this.

Answer: \ls

Q35) In what directory does undelivered remote mail get stored in? Type the full path and name of the file.

Answer: /var/spool/mqueue

Q36) Which utility is used to create or update the modules.dep file? Type the command only.

Answer: depmod

Q37) What commmand can you use to determine the users connected to a Linux ftp server? Type just the command to accomplish this.

Answer: ftpwho

Q38) What file is used to define a list of users that may NOT login to via the ftp daemon? Type just the name of the file.

Answer: ftpusers

Q39) To change your Ethernet interface eth0 to the IP address 10.4.4.100 with a default class C subnet mask, type the full command string to accomplish this.

Answer: ifconfig eth0 10.4.4.100 netmask 255.255.255.0

Q40) You are running a Red Hat machine. You have added a 2nd NIC to your machine and rebooted it. The card is detected in the BIOS but is not configured along with the eth0 interface upon network start. A file must be created to allow this interface to function. Type the full path and name of the file.

Answer: /etc/sysconfig/network-scripts/ifcfg-eth1

Q41) Undelivered mail for local system users is stored in what directory? Type the full path of the directory.

Answer: /var/spool/mail/username

Q42) What section of the Man pages are system administration commands in? Type the numeral of the section.

Answer: 8

Q43) What section of the Man pages are system files mentioned in? Type the numeral of the section.

Answer: 5

Q44) What command will display the active connections and Unix domain sockets for a running Linux machine with networking configured? Type just the command to accomplish this.

Answer: netstat

Q45) Converting from the inetd to xinetd services requires populating entries in what file, including the full path and name?

Answer: /etc/xinetd.conf

Q46) You have a job schedueled to run at 16:30 using the AT schedueler. When you type atq it displays the following information
[root@localhost root]# atq
2 2003-03-14 16:00 a root
[root@localhost root]#
Type in the command to remove only this job.

Answer: atrm 2

Q47) What command will show pending jobs that will be executed once on a given date and time? Type just the command to accomplish this.

Answer: atq

Q48) The last command functionality needs what log file to be present to operate properly? Type the full path and name of the file.

Answer: /var/log/wtmp

Q49) Where should you put the .pinerc file so that all new users get it as part of their initial creation? Type the full path of the directory.

Answer: /etc/skel

Q50) What command with options will show you the contents with associated pathnames of an archive file named archive.tar.gz? The file must not be unpacked with the command string. Type the full command string to accomplish this.

Answer: tar -tzvf archive.tar.gz
Alternative correct answers:
tar tzvf archive.tar.gz
tar zxvf archive.tar.gz
tar -zxvf archive.tar.gz

Q51) On a Red Hat system, with a single floppy drive and a returned output from the uname command of 2.4.20-12, what exact command string will create a customized boot disk for this system? Type the full command string to accomplish this.

Answer: mkbootdisk –device /dev/fd0 2.4.20-12

Q52) On a Debian-based system, what command will create a boot disk on the first floppy if your kernel image is named “vmlinux-2.4.18-4”? Type the full command string to accomplish this.

Answer: mkboot vmlinux-2.4.18-4
Alternative correct answer:
mkboot /boot/vmlinux-2.4.18-4

Q53) You need to view the hardware address and IP address information for all of your configured and active interfaces. Type the simplest command string that will accomplish this.

Answer: ifconfig

Q54) What command will most effectively send a list of certain files from a directory to the tar or cpio command? Type just the command name.

Answer: ls
cat

Q55) On your system exists a file that is described as a map file that is used to update the MBR or first sector of the partition with the appropriate booting information. Type the full path and name of the file.

Answer: /etc/lilo.conf

Q56) In the /etc/resolv.conf file are entries that describe where DNS queries can resolve names to IP addresses. Given a DNS server with an IP address of 192.168.33.254, type the exact entry that should appear in this file.

Answer: nameserver 192.168.33.254

Q57) Your IP address is 170.35.13.28 and your network mask is 255.255.255.192. What host IP address is NOT a part of your local subnet?
A. 170.35.13.33
B. 170.35.13.88
C. 170.35.13.62
D. 170.35.13.55
Type in just the letter of the answer.

Answer: B

Q58) Type in the simplest command to display the previous and current run level?

Answer: runlevel

Q59) When booting your system, you beleive you saw an error message go by too quickly to see. Type in the command that will show the last system bootup messages.

Answer: dmesg

Q60) You are in run level 5 and wish to change to run level 1. Type in the simplest command to do this?

Answer: init 1
Alternative correct answers:
init s
init S

Q61) The dmesg command outputs information from which file, inlcude full path?

Answer: /var/log/dmesg

Q62) Which process has a PID of 1. Type in the process name?

Answer: init

Q63) What is the name of the file and location that governs what run level is to be booted to on startup. Give full path and file name

Answer: /etc/inittab

Q64) You wish to list out in text all the daemons running and stopped on your system for all run levels. Type in the simplest command

Answer: chkconfig –list

Q65) You wish to change the daemons that start at a run level 3. Type in the command that would give a text menu based application to set the daemons for this runlevel

Answer: ntsysv –level 3

Q66) You wish to add the user luke to the system including his home directory. Type in the simplest command to do this including switches

Answer: useradd -m luke

Q67) You wish to remove the user alex from the system, including his home directories. Type in the simplest command to do this?

Answer: userdel -r alex

Q68) User shawn has been suspended from your company and you wish to lock his account to stop anyone using it. Type in the simplest command to do this.

Answer: usermod shawn -L
Alternative Answer: passwd -l shawn

Q69) User alex has been exiled to the marketing department who has a group name mktg. You now wish to change the primary group for the user alex to the mktg group. Type in the simplest  command to do this?

Answer: usermod -g mktg alex

Q70) Your user matt has forgotten his passwd and you wish to reset it. Type in the command line to change his password. You are currently logged in as root.

Answer: passwd matt

Q71) What is the full path and file name of the file that contains the configuration files for system logging? Type in full path and file name.

Answer: /etc/syslog.conf

Q72) You wish to list the contents of your crontab. Type in the simplest command to do this.

Answer: crontab -l

Q73) You wish to make changes to your crontab entry. Type in the simplest command to make this change?

Answer: crontab -e

Q74) You wish to archive and compress all the files in your home directory starting with the word projects into a file called projects.tar.gz. You are currently in your home directory. Type in the command that would do this?

Answer: tar -czf projects.tar.gz projects*
Alternative correct answers:
tar czf myprojects.tar.gz projects*
tar -zcf myprojects.tar.gz projects*
tar zcf myprojects.tar.gz projects*

Q75) You have a tarball called projects.tar.gz and you wish to view the permissions and ownership of its contents without unpacking it. Type in the simplest command to do this.

Answer: tar -tzvf projects.tar.gz
Alternative Answers:
tar tvzf projects.tar.gz
tar zvtf projects.tar.gz
tar ztvf projects.tar.gz

Q76) Type in the command to list your current kernel version, including any switches.

Answer: uname -a
Alternative Answer: uname -r

Q77) You wish to install the module fat.o into the kernel. Type in the simplest command to do this. Assume there are no dependancies for this module.

Answer: insmod fat

Q78) You wish to remove a module from the kernel called fat. Type in the simplest command to do this. Assume this module has no dependancies.

Answer: rmmod fat

Q79) Type in the simplest command to list all loaded modules?

Answer: lsmod

Q80) You wish to get infomation on a module called msdos.o. Type in the simplest command that would list all information including author and description for the module.

Answer: modinfo msdos

Q81) You have a module called msdos.o which has a dependancy on fat.o. What single command will load msdos.o and its dependant fat.o module in one command line?

Answer: modprobe msdos

Q82) Type in the simplest command, including any switchs, to rebuild the modules.dep file after you have made changes to the modules.conf file.

Answer: depmod -a

Q83) You are using X and wish to build a new kernel. What X tool would you use to build the .config file. Type in just the command, not switches.

Answer: make xconfig

Q84) You have made changes to your /etc/lilo.conf file. Type in the simplest command that will reload the configuration to the MBR.

Answer: lilo

Q85) Type in the command to compile a kernel image with normal compression.

Answer: make zImage

Q86) Type the command to check the syntax and contents of the smb.conf file.

Answer: testparm

Q87) Type in the command to monitor connections to Samba.

Answer: smbstatus

Q88) Type in the name and full path to the network configuration file that defines the search order for name resolution.

Answer: /etc/nsswitch.conf

Q89) Type in the name of the file including path of the static host name to IP address configuration file.

Answer: /etc/hosts

Q90) Type in the name and full path to the config file that contains the IP address of DNS servers for hostname resolution.

Answer: /etc/resolv.conf

Q91) You need to access the site for HOWTO’s, Guides and mini HOWTO’s. Type in the full URL as it would appear in any browser, including the protocol.

Answer: https://www.techhyme.com

Q92) Type in the command that is equivalent to man -k.

Answer: apropos

Q93) Type in the command that is equivalent to man -f.

Answer: whatis

Q94) You wish to restart the network daemon on a Redhat Server. Type in the command and any arguments that to accomplish this without using any absolutes pathnames.

Answer: service network restart

Q95) You wish to restart both Samba daemons. Type in the command and any arguments that to accomplish this without using any absolutes pathnames.

Answer: service smb restart

Q96) Type in the file and full path to the configuration file for the Sytem logging daemons.

Answer: /etc/syslog.conf

Q97) You have just downloaded an application called rdesktop from the internet. The file downloaded is named rdesktop.tar.gz. Type in the simplest command to decompress and untar this file into the current directory.

Answer: tar -zxf rdesktop.tar.gz
Alternative Answer: tar zxf rdesktop.tar.gz

Q98) Type in the full path and name of the global environment and startup program configuration file. This file typically contains the PATH, umask and ulimit system wide settings.

Answer: /etc/profile

Q99) A user wishes to modify his Environment variable PATH, WHat file should you tell him to edit in his home directory. Give filename only, no path.

Answer: .bash_profile

Q100) Type in the name of the samba daemon that is responsible for WINS names resolution

Answer: nmbd

Q101) Type in the name of the samba daemon that is responsible for printer and file sharing?

Answer: smbd

Q102) Type in the name of the file including full path that holds contains a daily message viewed by users when they log in?

Answer: /etc/motd

Q103) Type in the name of file and full path to the file that holds a message for remote users about possible system outages.

Answer: /etc/issues.net

Q104) You wish to change you network settings permanently using a text/graphical tool. Type in the command to start this tool?

Answer: netconfig

Q105) What is the command to check the syntax of your /etc/inetd.conf?

Answer: tcpdchk

Q106) What command would be used to check the gpgp signature on a downloaded source file? Type just the name of the command.

Answer: gpg

Q107) What command was typed in to produce the output shown below. The entries shown are the full output of the command, less the actual command. Type the command and the options to reproduce similar output.

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 394 0.0 0.0 1200 444 tty1 S 01:05 0:00 /sbin/getty 38400 tty1
root 396 0.0 0.0 1200 444 tty3 S 01:05 0:00 /sbin/getty 38400 tty3
root 397 0.0 0.0 1200 444 tty4 S 01:05 0:00 /sbin/getty 38400 tty4
root 398 0.0 0.0 1200 444 tty5 S 01:05 0:00 /sbin/getty 38400 tty5
root 399 0.0 0.0 1200 444 tty6 S 01:05 0:00 /sbin/getty 38400 tty6
root 423 0.0 0.0 1200 444 tty2 S 01:06 0:00 /sbin/getty 38400 tty2
root 426 0.2 0.3 2880 1964 pts/0 S 01:07 0:00 -bash

Answer: ps -au

Q108) You wish to execute the ls command but it appears to be aliased. What is the easiest way of execute the orignal ls command without the alias?

Answer: \ls

Linux Interview Questions

Got a question for us? Please send us via mail (contact@techhyme.com) and we will get back to you. If you wish to learn Linux Administration and build a colorful career, then check out our Questions page.  And we hope these Linux Interview Questions will help you perform well in your interview.

All the best!

You may also like:

Related Posts