How to Crack the Linux Administrator Interview: 55 Interview Questions
Linux administrators are the backbone of modern-day organizations. They maintain the computer systems used by the whole company, with the goal of keeping the environment running around the clock!
Linux administrators work with senior business executives on capacity planning and provide real-time dashboard reporting to monitor system uptime availability, status, and performance against capacity goals.
Linux administrators work with development teams on Development Operations (DevOps) and Continuous Integration (CI) tools and processes. They recommend and maintain the tools and scripts to support development environments for automated testing, bug reporting, code repositories, deployment, and production support.
Last Updated September 2021
Linux Administration (Ubuntu and CentOS) for Beginners. Get the Linux skills to boost your career and get ahead. | By Andrei Dumitrescu, Crystal Mind AcademyExplore Course
With such a wide range of tasks and responsibilities, these jobs are in demand and exciting!
Below are 55 interview questions and answers you might encounter during an interview for a Linux system administrator job.
Linux Operating System
1. What is Linux?
Linux is an operating system (OS) introduced by Linus Torvalds. It is based on the Unix operating system.
2. What is the difference between Unix and Linux?
Unix is a commercial operating system introduced by AT&T Bell Labs in the early 1970s. Linux is a Unix clone developed as a free, open-source, non-proprietary operating system. Linux was built by Linux Torvalds and released in 1991.
3. What is the Linux Kernel?
The Linux Kernel is a multitasking software program tasked with efficiently managing the computer hardware and the Linux operating system.
4. What is LILO?
LILO (Linux Loader) is a boot loader that loads the Linux OS into memory so that it can start operating.
5. What is Bash?
Bash is an application. When the user opens a text or terminal window into Linux, they run a Bash shell where they enter commands interpreted and executed by the Bash shell.
6. Describe the root account.
Root is the superuser account in Linux. As the system administrator, this user has access to the highest rights in the system.
7. What is swap space?
Swap space is the portion of virtual memory on the hard drive. It is used as overflow when RAM is full or to store data for programs not used often.
8. What is the typical size for a swap partition?
For systems that use hibernation, the minimum swap space size should be equal to the RAM size. Without hibernation, the minimum should be (round(sqrt(RAM)). The maximum swap space size should be twice the RAM.
9. Name some editors you have used in Linux.
Vi and VIM are the top editors in Linux. Other options include Nano, Gedit, GNU Emacs, and Pico.
10. What does the CTRL+ALT+DEL key combination do?
A system restart similar to Windows, but the difference is there is no message – the restart process is immediate.
11. What is a virtual desktop?
A virtual desktop is a desktop environment running on a remote server instead of a local PC or computer. The virtualization software separates the desktop, programs, and data from the client hardware.
12. How do you switch between desktops? For example, KDE and Gnome?
Workspace switcher software allows the user to click on the desktop to switch to. Using keys, the CTRL+ALT+right or left arrow keys change to different running desktops.
Ports, drives, and partitions
Devices and the ability to access and maintain them is important. Whether you are setting up a network printer, provisioning a new server, or analyzing a problem, it is important to understand the system’s structure and I/O components.
13. How do you refer to a parallel port like those used with printers?
Parallel ports are referred to with /dev/lp. There are multiple parallel ports accessed with /dev/lp0, /dev/lp1, /dev/lp2, etc.
14. What names are assigned to the different serial ports?
Serial ports are assigned /dev/ttyS0 through /dev/ttyS7.
15. How do you reference drives?
Drives in Linux are referenced as /dev/hda, /dev/hdb, /dev/hdc, etc.
16. How do you access partitions?
Partitions in Linux are numbered. If drive /dev/hda has three partitions, they would be accessed as /dev/hda1, /dev/hda2, and /dev/hda3.
Folders, files, and links
Linux has a specific directory structure installed with the operating system. Within this structure, Linux administrators maintain a set of folders, files, and links to provide access and security to the data and executables stored on the server.
17. What does the Linux directory structure look like? Can you name some of the folders and their designated use?
/ The Root directory has everything on the system – it is the top folder.
/boot Static executable files needed to boot the system
/etc System-wide configuration files, including those used to boot the system
/bin Essential Linux binaries related to system programs and binaries like Bash
/home Contains a folder for each user to store user configuration and data files
/usr Read-only directory containing applications and files used by users
/var Read-write directory with data files like log files
18. What are the three kinds of permissions under Linux?
Read, write, and execute. Files and folders are assigned one or a combination of these access rights.
19. How do you change permissions to a folder or file?
If you are the system administrator or owner of the file or folder, you can use the chmod command. The command takes the following parameters:
- [optional used in symbolic mode] Character string indicating who to apply the permissions to (u-user, g-group, o-others, or a-all)
- + or – to add or deny permissions
- Permission types: r-read, w-write, x-execute
- The file or folder to apply the permissions to
In symbolic mode, users, groups, and others are provided different access levels to a file:
chmod u=rwx,g=rx,o=r filename
In absolute mode, there is general access to the file set:
chmod rwx filename
20. What is the maximum length of a file name?
Excluding the path, the file name can be up to 255 characters.
21. What is the significance of a dot at the start of a file name?
The dot indicates it is a hidden file.
22. What are symbolic links?
Symbolic links are a type of file in Linux that point to or reference another file or folder. These are also called symlinks or soft links.
23. What are hard links?
A hard link is a type of file in Linux that points to the data of another file. The pointer is called an “inode” in file system terminology. If the original source file is deleted, the file remains accessible through the hard link.
Shells and GUIs
24. What is a shell?
A shell is a program that takes commands as input and submits them to the OS for execution. The commands can come from a CLI text-based or a GUI graphical shell.
25. What is CLI?
The Command Line Interface (CLI) allows the user to enter declarative commands for the OS to execute.
26. What is GUI?
The Graphical User Interface (GUI) renders images users can interact with to communicate with the computer. For example, a button to be clicked.
27. Can you name some line commands related to manipulating files?
cp [from file] [to file] Copy a file to a new file
mv [from file] [to file] Move a file
rm [filename] Delete a file
rm -rf Delete all files in the directory without confirmation
touch [filename] Create a file without opening it
sort [filename] Sort entries in a file in ascending order
28. Can you name some line commands related to displaying and listing directories?
pwd Print working directory prints the current directory
ls List the files and directories in the current directory
cd Change to a new directory
mkdir Make a new directory
rmdir Delete a directory
du -sh [directory] Calculate the size of a directory
29. How do you search a file or find the location of a file?
grep Search files for a string pattern
locate Prints the location of a file
30. How do you list active processes? Can you stop one from running?
ps List running processes
ps ux Get the status of a process
Kill [pid] Stop a process. A pid of 0 will stop all processes.
31. What is the service command, and can you describe how you would use it?
You would use the service command to monitor and control processes and daemons. Some example uses include:
service [name] status Check the status of a service
service status-all Check the status of all services
service [name] start Start a service
service [name] stop Stop a service
service [name] restart Restart a service
32. What kinds of processes and daemons accept service commands?
All scripts in the /etc/init.d directory accept service commands. Some of these processes include ssl/httpd and sshd.
33. What is redirection?
Redirection allows the user to change the standard input/output/error device. Linux administrators use these commands to configure the environment and monitor processes.
34. What are the three file descriptors used with redirection?
STDOUT, STDIN, and ERROR
35. What is the redirection symbol for the Output file descriptor?
The symbol “>” is used for the STDOUT redirection.
36. Can you list some Output examples?
ls -al > listings
The output from the command “ls -al” will be put in a file named listings instead of the standard output (STDOUT) device, the screen.
The command cat dumps a file out. Without redirection, the contents of the file display on the screen.
cat file1 >> file2
This appends file1 to the end of file2. The double symbol “>>” will create file2 if it does not exist.
cat file1 file2 file3 > file4
This appends file1, file2, and file3 to the end of file4. It will not create file4 if it does not exist.
cat my_song.mp3 > /dev/audio
Redirection can send data to a device. In this case, if you configure the audio device, this will copy the contents of my_song.mp3 to the audio device, and it will play.
The file descriptor for STDOUT is 1. In this case, when my_program executes, any non-error output will log to the output.txt file.
37. What is the redirection symbol for the Standard In (STDIN) redirection?
The symbol “<” is used for the STDIN redirection.
38. Can you list an example of the STDIN redirection?
$ mail -s [subject] [email of recipient] < send_me.txt
This mail command sends an email to the email address with the file send_me.txt attached.
39. What are the file descriptors for STDIN and STDOUT?
The file descriptor for STDIN is 0, and STDOUT is 1.
40. What is the redirection system for the Error file descriptor?
By default, all errors stream to the terminal window. The file descriptor for STDERR is 2. You can use this with an ampersand to redirect to a file.
41. Can you list some examples of how to use the Error file descriptor?
$ my_program 2>errors.txt
Errors from executing my_program will log to the errors.txt file.
$ my_program >AllOutput.txt 2>&1
The STDOUT redirection logs non-error output to the AllOutput.txt file. The ERROR redirection logs errors to STDOUT – notated by the ‘&1’ file descriptor. This command ultimately pipes all output to the AllOutput.txt file.
42. How do you find out how much memory Linux is using?
The commands top, htop, and vmstat will display memory usage.
Using the concatenate command cat/proc/meminfo will print the memory information from the /proc/meminfo file to the terminal screen.
You can use the free line command with the -m option to see the results in Mb or -g for Gb.
43. What are daemons?
Daemons are programs that run in the background, waiting to be activated by an event or condition. When the daemon is triggered, it performs a specific function or service, then waits to be called again.
44. What is nohup?
You can use the command nohup to start a program and allow it to continue running after logging out. Without nohup, the program will terminate when the user that created it logs out.
45. What is Cron? Provide an example of how to use it.
Cron is a task scheduler. The commands are stored in the Cron file in the following format:
[minute] [hour] [day] [month] [weekday] [command]
For example, to schedule a backup process at 10:00 p.m. every Sunday:
0 22 * * 0 [backup process command]
You can edit the Cron file with any editor. By default, the command ‘Crontab -e’ will start the configured default editor.
Commands are often configured with redirection to log the output or errors to standard files or read input files.
46. What is the Advanced Packaging Tool (apt)?
The apt is a command-line tool used to maintain the library packages. This includes the version of Linux, programs like Python or Perl scripting languages, or databases like MySql. All programs can be installed, updated, or removed as packages with the apt tool.
47. What is the scheduler at? Provide an example of how to use it.
You can use the at scheduler to schedule a one-time execution of a task.
For example, to schedule a special backup for the current day at 8:00 p.m.:
$ echo [backup process] | at -m 20:00
Environment variables are variables set up in the unix shell when the user logs in. They allow administrators to maintain a system-wide set of commands and users to maintain a private set available only to their user login. Environment variables make the system easier to use.
48. What are environment and shell variables?
Variables are key:value pairs. The key is a command that can be called on the command line or in scripts to execute the command in the value.
49. What is the difference between environment and shell variables?
Environment variables exist for all programs, shells, applications, daemons, and so forth. Shell variables only exist within the context of a shell.
For example, the user can define a shell variable to set the editor. The variable will exist as long as the user is logged in. After the user logs out, the variable is no longer available.
To make that variable available every time the user logs in, they can make it an environment variable:
$ export EDITOR
50. How do you set and use an environment variable?
To set a home directory:
$ export HOME=”/home/[user directory]" $ export HOME="/home/[user directory]"
You can use this variable in scripts or on the command line:
Navigate to the home directory
Copy a file in the home directory
cp $HOME/from-file $HOME/to-file
51. What are some commands used to manage environment variables?
This is used to run another program in a custom environment without modifying the current environment. Without an argument, the current environment variables are listed.
This prints all or specific environment variables.
Set or Unset shell variables. Without an argument, all environment and shell variables are listed.
Unset deletes shell and environment variables.
Export sets environment variables.
52. What are some common uses for environment variables?
USER The current logged-in user
HOME The home directory of the logged-in user
EDITOR The default editor to be used when edit is typed
PATH A list of directories to be searched when executing commands
53. Can you name some shell scripting languages?
sh, bash, csh, and tcsh
54. How would you write a script to delete all files in the current directory that contain the text “find” in the file name.
for i in *find*; do rm $i; done;
What are some commonly used higher-level scripting languages?
Higher-level scripting languages include TCL, Python, and Perl. Python is currently the most commonly used scripting language.
Top courses in IT & Software
A career as a Linux administrator is demanding, rewarding, and has many growth opportunities. While the work of a Linux administrator is primarily technical, it also involves working closely with business executives to understand the direction of the business and propose future capacity plans. Linux administrators are adjunct participants on project teams providing guidance on tools and best practices.
Most of the work performed by the Linux administrators is behind the scenes. There are no parties for project launches or celebrating sales goals. But it is the 99.9% uptime that everyone relies on. This may be a blessing in disguise, because if there is a blip in a connection, a crashed program, or a performance bottleneck, it is your name that is on everyone’s lips.
Linux teams know when to celebrate and should do so — they are keeping more than the lights on!
Top courses in Linux
Linux students also learn
Empower your team. Lead the industry.
Get a subscription to a library of online courses and digital learning tools for your organization with Udemy for Business.