Linux interview questions: Best answers to get your foot in the Linux door

interviewLinux is an open-source operating system. It has gained immense popularity through the years, setting the bar for ease-of-usability, high-grade security features, advanced shell scripting terminals, and free to users.  Consequently, these great features of Linux have made the hiring process more competitive than ever. The good news is, technical questions asked during phone interviews and even face-to-face interviews tend to be fairly predictable. Employers rarely ever go into detailed technical scenarios. Even better, you will encounter many of the same technical questions at almost all interviews you attend. Read on to see the most commonly asked questions and answers at a Linux interview.

If you’re new to Linux, here’s an introductory course to setup, manage, and customize your own Linux desktop.

Let’s start with some basic questions that might not necessarily be asked (because they’re too easy) but are essential basics everyone interested in Linux needs to know.

What is the core of Linux Operating System?

The core of the Linux operating system is Kernel. It is broken down into Shell, Command, Script, and Terminal. Shell is a command Line Interpreter, Command is user Instruction to Computer, Script is collection of commands stored in a file, and Terminal is a command Line Interface.

What is the basic difference between UNIX and Linux Operating System?

Linux is free and open-source software (allowing programmers to program with Linux not around it), the kernel of which is created by Linus Torvalds and community. UNIX, on the other hand, is UNIX is copyrighted name only big companies are allowed to use the UNIX copyright and name, so IBM AIX and Sun Solaris and HP-UX all are UNIX operating systems.

What is an INODE?

All files have its description stored in a structure called ‘inode’. The inode contains info about the file-size, access and modification time, permission and so on. In addition to descriptions about the file, the inode contains pointers to the data blocks of the file.

State the syntax of any Linux command.

The correct syntax of Linux command is Command [options] [arguments]. Master the Linux command line with this guide.

Now let’s move on to the meatier questions that are more likely to be asked:

What is the difference between TCP and UDP?

The basic difference is that TCP establishes a connection before sending data and this allows it to control the dataflow and guarantee that all packets get delivered. UDP simply chucks datagrams onto the wire and if some get lost or arrive in bad order there’s no way to request a resend. However UDP has low network overhead so some services such as DNS resolution, SNMP, DHCP, RIP and VOIP use UDP for its speed and any errors are usually dealt with on the application layer rather than network layer.

How does DNS resolution work?

A client application requests an IP address from the name server usually by connecting to UDP port 53. The name server will attempt to resolve the FQDN based on its resolver library, which may contain authoritative information about the host requested or cached data about that name from an earlier query. If the name server does not already have the answer, it will turn to root name servers to determine the authoritative for the FQDN in question. Then, with that information, it will query the authoritative name servers for that name to determine the IP address.

What is an MX record?

An MX record numerically ranks the mail servers you would prefer to receive email for a domain. The MX record with the lowest number is preferred over the others, but you can set multiple email servers with the same value for simple load balancing.

Please describe the Linux boot-up sequence.

There are seven steps to the boot-up sequence. 1) BIOS (basic input/output system) – executes the MBR where Boot Loader sits, 2) MBR- Master boot reads Kernel into memory, 3) GRUB (Grand Unified Bootloader) Kernel starts Init process, 4) Kernel – Kernel executes the /sbin/init program.  Init reads inittab, executes rc.sysinit, 5) Init – the rc script than starts services to reach the default run level and 6) Run level programs – these programs are executed from /etc/rc.d/rc*.dl/

How do you search for a pattern and then replace it in an entire file?

You use Sed, or in Vi editor, the search uses character ‘s’ slash the pattern to be searched, slash the pattern to replace it with, slash ‘g’ which stands for entire file.

How do you list and flush all IPtables?

First you use the –L switch to view all the currently present rules and then –F to flush them.

What is a shell? What are their names?

The shell is the part of the system with which the user interacts. A Unix shell interprets commands such as “pwd”, “cd” or “traceroute” and sends the proper instructions to the actual operating system itself. The shells currently available areAns SH, BASH, CSH, TCSH, NOLOGIN, KSH. Other functions of a shell include scripting capability, path memory, multitasking, and file handling.

What is a zombie?

Cheeky answers get bonus points for this one. But in the Linux world, a zombie process is the process  output of ‘ps’ by the presence of ‘Z’ in the STAT column. Zombies are essentially the premature processes whose mature parent processes died without reaping its children. Note that zombies can’t be killed with the usual ‘kill’ signal.

We hope this questions have helped you in your Linux interview preparation. If you’d like a more advanced tutorial on Linux and running Linux administration, learn to run Linux servers from scratch here.