• Home
  • >
  • Tech News
  • >
  • #30 Essential Linux Interview Questions – Update

Main Contents:

If you’re a developer, sysadmin, or just curious about Linux, this list is for you. It contains all the common questions asked in an interview for a Unix-like system administration or programming position that relates to Linux.

Linux is a Unix-like operating system that has been around for decades and was originally based on the Unix kernel. Linux is an open-source operating system, which means it is freely available and can be modified by anyone with the knowledge. And it’s not just for your desktop computer – Linux runs servers around the world.

Linux is used to power everything from our Android smartphones to web servers that keep everyday websites up and running. Linux powers supercomputers, the enterprise data centers of the world’s top tech companies, and everything in between. And even though this operating system might not be as well known as industry heavyweight Windows, Linux has been around for more than 27 years.

In the world of Linux, there are a set of commands that you will need to know in order to interact with your system. We are always going to talk about the most important commands, and how they work.

Linux, however, used to be the butt of jokes among the software elite. But today, Linux is at the forefront of innovation in operating systems. The Silicon Valley giants such as Google and Facebook use Linux for their clusters and data centers. So what happened?

As with any operating system, Linux administration is a substantial topic. It has the advantage of being open source and free to use, but like all computer systems, it can be difficult to learn how to administer it.

Key Summary

  • Overview: The article by InApps Technology presents 30 essential Linux interview questions updated for 2022, designed to help candidates prepare for roles requiring Linux expertise. It covers foundational concepts, commands, system administration, networking, and security, aligning with the user-provided excerpt and emphasizing practical knowledge for developers and sysadmins.
  • Key Linux Interview Questions (Summarized):
    • 1. Basic Elements of Linux:
      • Question: What are the basic components of Linux?
      • Answer: Linux comprises five core elements:
        • Kernel: Manages processes, devices, and memory.
        • System Library: Enables applications to access kernel features without custom code.
        • System Utility: Performs specialized tasks for system management.
        • Hardware: Includes physical components (e.g., CPU, mouse).
        • Shell: Interfaces between users and the kernel, executing commands and scripts.
      • Example: Bash shell runs commands like ls to list files.
    • 2. What is LILO?:
      • Question: Define LILO.
      • Answer: LILO (Linux Loader) is a boot loader that loads the Linux OS into main memory to start operations.
      • Example: LILO configures boot options in /etc/lilo.conf.
    • 3. Why is LVM Required?:
      • Question: Explain the need for LVM.
      • Answer: Logical Volume Management (LVM) allows flexible storage management by creating, resizing, or deleting partitions, grouping devices into logical units for abstraction and control.
      • Example: Resizing a partition for a growing database using lvresize.
    • 4. Network Bonding Modes in Linux:
      • Question: List the modes of network bonding in Linux.
      • Answer: Seven modes include:
        • Mode-0 (balance-rr): Round-robin, offers load balancing and fault tolerance.
        • Mode-1 (active-backup): One active slave, others as backups.
        • Mode-2 (balance-xor): XOR-based load balancing.
        • Mode-3 (broadcast): Transmits to all slaves.
        • Mode-4 (802.3ad): Dynamic link aggregation.
        • Mode-5 (balance-tlb): Adaptive transmit load balancing.
        • Mode-6 (balance-alb): Adaptive load balancing, no switch support needed.
      • Example: Configuring mode=1 in /etc/network/interfaces for failover.
    • 5. Default Ports for Common Services:
      • Question: What are the default ports for SMTP, DNS, FTP, DHCP, SSH, and Squid?
      • Answer:
        • SMTP: 25
        • DNS: 53
        • FTP: 20 (data), 21 (control)
        • DHCP: 67 (server), 68 (client)
        • SSH: 22
        • Squid: 3128
      • Example: Opening port 22 for SSH with ufw allow 22.
    • 6. Removing Files or Directories:
      • Question: How to remove a file or directory in Linux?
      • Answer: Use rm for files and rmdir for empty directories.
        • rm filename: Removes a single file.
        • rm -r dir: Removes a directory and its contents.
        • rm -i file: Prompts for confirmation.
        • rmdir dir: Removes an empty directory.
      • Example: rm -rf logs/ deletes a logs directory recursively.
    • 7. PIPE in Linux:
      • Question: What is a PIPE in Linux?
      • Answer: A PIPE (|) redirects output from one command as input to another, combining multiple commands.
      • Example: ls -l | grep .txt lists text files.
    • 8. Zombie Process:
      • Question: Define a zombie process.
      • Answer: A completed process whose entry remains in the process table until the parent reads its status via a wait system call, typically caused by child processes.
      • Example: Killing a parent process with kill -9 PID to clear zombies.
    • **9. Stateless Linux Server Features:
      • Question: What are the features of a Stateless Linux Server?
      • Answer:
        • Stores system prototypes and snapshots.
        • Manages home directories.
        • Uses LDAP to store snapshot-to-system mappings.
      • Example: Deploying consistent server images via LDAP.
    • 10. Running Commands for Limited Time:
      • Question: How to run a command for a limited time?
      • Answer: Use timeout:
        • timeout 10s ./script.sh: Runs script for 10 seconds.
        • while true; do timeout 30m ./script.sh; done: Restarts every 30 minutes.
      • Example: timeout 5m backup.sh limits backup to 5 minutes.
    • 11. Run Command on File Modification:
      • Question: How to run a command when a file is modified?
      • Answer: Use inotifywait:
        • while inotifywait -e close_write file; do command; done
      • Example: inotifywait -e close_write doc.tex; do make rebuilds on file change.
    • 12. Handling tar.gz Files:
      • Question: How to list or extract a single file from tar.gz?
      • Answer:
        • List: tar -tf file.tar.gz
        • Extract: tar -xf file.tar.gz filename
      • Example**: tar -xf archive.tar.gz README.md extracts one file.
    • 13. Get Full Path:
      • Question: How to get a file’s full path?
      • Answer: Use readlink -f file.txt.
      • Example: readlink -f config.yaml outputs /home/user/config.yaml.
    • 14. Limit Memory Usage:
      • Question: How to limit memory usage for commands?
      • Answer: Use ulimit:
        • ulimit -Sv 1000: Limits to 1MB.
        • ulimit -Sv unlimited: Removes limit.
      • Example: ulimit -Sv 5000; ./app runs app with 5MB limit.
    • 15. Linux vs. Windows:
      • Question: Compare Linux and Windows.
      • Answer:
        • Linux: Free, open-source, customizable, secure, case-sensitive, multi-user.
        • Windows: Paid, proprietary, less customizable, less secure, case-insensitive, primary partition-based.
      • Example: Linux uses /, Windows uses \ for paths.
    • 16. df Command:
      • Question: What is the df command?
      • Answer: Displays free disk space (df -h for human-readable format).
      • Example: df -h /var shows disk usage for /var.
    • 17. du Command:
      • Question: What is the du command?
      • Answer: Shows detailed disk usage for files/directories (du -sh path).
      • Example: du -sh /var/log/* lists log file sizes.
    • 18. env Command:
      • Question: What is the env command?
      • Answer: Sets or prints environment variables for troubleshooting.
      • Example: env | grep PATH displays PATH variable.
    • 19. ps Command:
      • Question: What is the ps command?
      • Answer: Displays process status (ps -ef for all processes).
      • Example: ps -ef | grep nginx checks nginx processes.
    • 20. grep Command:
      • Question: What is the grep command?
      • Answer: Searches for patterns in files or command output.
      • Example: grep “error” log.txt highlights error lines.
    • 21. cat Command:
      • Question: What is the cat command?
      • Answer: Concatenates and displays file contents.
      • Example: cat requirements.txt shows dependency list.
    • 22. tail Command:
      • Question: What is the tail command?
      • Answer: Displays the last lines of a file (tail -n 100 file).
      • Example: tail -n 50 access_log shows recent HTTP requests.
    • 23. Linux Security Advantages:
      • Question: Why is Linux more secure?
      • Answer: Open-source, limited user access, strong community, iptables, diverse environments, detailed logging, fewer users.
      • Example: Iptables rule: iptables -A INPUT -p tcp –dport 22 -j ACCEPT.
    • 24. Ctrl+Alt+Del in Linux:
      • Question: What does Ctrl+Alt+Del do in Linux?
      • Answer: Restarts the system without confirmation.
      • Example: Triggers immediate reboot on a Linux server.
    • 25. Internal vs. External Commands:
      • Question: Differentiate internal and external commands.
      • Answer:
        • Internal: Run directly by the shell (e.g., cd), no separate process.
        • External: Run by the kernel with unique PIDs (e.g., ls).
      • Example: cd /home (internal) vs. ls /home (external).
    • 26. BASH vs. DOS:
      • Question: Compare BASH and DOS.
      • Answer:
        • BASH: Case-sensitive, uses /, no file naming conventions.
        • DOS: Case-insensitive, uses \, follows naming conventions.
      • Example: ls dir in BASH vs. dir in DOS.
    • 27. Linux Features:
      • Question: List Linux OS features.
      • Answer: Portable, open-source, multi-user, multiprogramming, secure (authentication, encryption), shell-based.
      • Example: Running multiple apps on a Linux server simultaneously.
    • 28. Why Use Linux?:
      • Question: Why choose Linux?
      • Answer: High stability, security, ease of use, hardware compatibility, open-source, efficient resource use.
      • Example: Auto-updating Ubuntu with apt update && apt upgrade.
    • 29. Linux Distros and Usage:
      • Question: Name Linux distros and their uses.
      • Answer:
        • Linux Mint: Stable, user-friendly, uses Mate/Cinnamon desktops.
        • Debian: Robust, stable, ideal for servers.
        • Ubuntu: Versatile for desktops/servers, Debian-based.
        • openSUSE: Beginner-friendly, enterprise-ready.
        • Manjaro: Pleasant for new/experienced users.
      • Example: Using Ubuntu for a web server with Nginx.
    • 30. Additional Common Questions (from Article):
      • Question: What is the chmod command?
      • Answer: Changes file permissions (e.g., chmod 755 script.sh).
      • Example: chmod u+x run.sh makes a script executable.
      • Question: Explain cron in Linux.
      • Answer: Schedules tasks using crontab (e.g., 0 0 * * * backup.sh runs daily at midnight).
      • Example: crontab -e to edit scheduled tasks.
  • Benefits of Preparing These Questions:
    • Skill Validation: Demonstrates proficiency in Linux administration and development.
    • Career Readiness: Prepares candidates for sysadmin, DevOps, or developer roles.
    • Practical Knowledge: Covers real-world tasks like process management, networking, and security.
    • Cost Efficiency: Offshore Linux expertise in Vietnam ($20–$50/hour via InApps) saves 20–40% vs. U.S./EU rates ($80–$150/hour).
  • Challenges:
    • Complexity: Commands like inotifywait or LVM require practical experience.
    • Memory Retention: Numerous commands and options demand regular practice.
    • Contextual Application: Applying commands correctly in specific scenarios can be tricky.
    • Security Risks: Misusing commands like rm -rf can cause data loss.
  • Security Considerations:
    • Command Safety: Use -i with rm to avoid accidental deletions.
    • Access Control: Restrict root access and use sudo for sensitive operations.
    • Logging: Monitor commands with auditd for compliance (e.g., SOC 2).
    • Example: InApps configures secure SSH access with key-based authentication for a client’s Linux server.
  • Use Cases:
    • DevOps: Automating deployments with cron and shell scripts.
    • SysAdmin: Managing storage with LVM and monitoring with df, du.
    • Development: Debugging apps with grep, ps, and tail.
    • Security: Configuring iptables and network bonding for secure systems.
    • Cloud: Managing Kubernetes clusters on Linux-based nodes.
  • InApps Technology’s Role:
    • Leading HCMC-based provider with 500+ experts in Linux, DevOps, and cloud-native development.
    • Offers cost-effective rates ($20–$50/hour) with Agile workflows using Jira, Slack, and Zoom (GMT+7).
    • Supports Linux-based projects, including server management, automation, and security configurations.
    • Example: InApps configures a secure Ubuntu server with LVM and iptables for a U.S. client’s e-commerce platform.
  • Recommendations:
    • Practice commands like grep, ps, and rm in a sandbox environment.
    • Study Linux distros (e.g., Ubuntu, Debian) and their use cases.
    • Learn security practices (e.g., iptables, SSH) to demonstrate expertise.
    • Partner with InApps Technology for cost-effective Linux solutions, leveraging Vietnam’s talent pool for robust system administration and development.
Read More:   Security Teams as Internal Consultants – InApps Technology 2022

Linux Interview Questions From the Expect Interviewers

Q.1 What are the basic elements or components of Linux?

Linux generally consists of five basic elements or components as given below:

  • Kernel: It is considered a core or main part of Linux and is generally responsible for all major activities of OS such as process management, device management, etc.
  • System Library: These are special functions or programs with the help of which application programs or system utilities can access features of the kernel without any requirement of code. It is simply used to implement the functionality of the OS.
  • System Utility: These are utility programs that are responsible to perform specialized and individual-level tasks. They are considered more liable and allow users to manage the computer.
  • Hardware: It is physical hardware that includes items such as a mouse, keyboard, display, CPU, etc.
  • Shell: It is an environment in which we can run our commands, shell scripts, and programs. It is an interface between user and kernel that hides all complexities of functions of the kernel from the user. It is used to execute commands.

Q.2 What is LILO?

LILO means Linux Loader is a boot loader that is used for the Linux operating system. Most of the Linux Operating systems use LILO, to boot the operating system into the main memory to start the operations.

Q.3 Why LVM is required?

LVM stands for Large Volume Management, it is a storage management device. Users can create, resize, and delete LVM partitions. It increases abstraction, flexibility, and control. LVM is used to gather existing storage devices into the group and allocate logical units.

Q.4 What are the different modes of Network bonding in Linux?

Different modes of Linux network bonding

  • Mode-0(balance-rr): It is a default mode and based on the Round-Robin policy. It offers fault tolerance and load balancing features. It used a round-robin fashion to transmit the packets.
  • Mode-1(active-backup): It is based on the Active Backup policy and only one slave will act in the band and another one will act when the others fail in the band. It also provides fault tolerance.
  • Mode-2(balance-xor): It sets a xor mode between the source Mac address and destination Mac address to provide fault tolerance.
  • Mode-3(broadcast): It is based on broadcast policy and transmitted everything in the slave interface. It also provides fault tolerance and can be used only for a particular purpose.
  • Mode-4(802.3ad): It is a dynamic aggregation mode, it created aggregation groups which is having the same speed. It uses the transmit hashing method to select the slaves for outgoing traffic.
  • Mode-5(balance-tlb): The outgoing traffic is according to the current load on the slave, and the incoming traffic is received by the slave. It is called an adaptive transmit load balancing mode.
  • Mode-6(balance-alb): It is an adaptive load balancing mode. It does not require any switch support.
Read More:   Vietnam needs a legal framework capable of promoting the application and innovation of blockchain products

Q.5 What are the default ports used for SMTP, DNS, FTP, DHCP, SSH, and squid?

Details mentioned below

Service Port
SMTP 25
DNS 53
FTP 20(Data Transfer) 21(Connections Established)
DHCP 68(dhcp client), 67(DHCP server)
SSH 22
Squid 3128

Q.6 How to remove a file or directory from the system in Linux?

rm command: The rm command is used to remove the directory or file specified on the command line. You need to be careful while removing any file or directory.

Syntax:

rm filename—

Command Description
rm filename Removes single file.
rm filename1, filename2, filename 3 Removes multiple files.
rm * .pdf Removes all pdf files in the current directory.
rm -i filename(s) -i mean to confirm before deleting the file
rm -i filename(s) Removes files without prompting
rm -fv *.txt Remove all .txt files in the current directory without prompting

Q.7 Explain rmdir command in Linux?

The rmdir is used to remove each directory specified on the command line.

Syntax:

rmdir [-p] [-v | –verbose] [–ignore-fail-on-non-empty] directories

Q.8 What is meant by PIPE in Linux?

It is a form of redirection that is used in Linux, it is used to combine more than two commands and the output of one command can take as input to the next command.

Syntax:

command_1 | command_2 | command_3 | …. | command_N

Q.9 What is Zombie Process?

It is a process whose execution is completed but even the information exists in the process table. It occurs for the child process because the parent process needs to read the child process status. Once it is completed using the wait system call, then the zombie process is removed from the process table. This is known as Zombie Process.

Q.10 Explain the features of Stateless Linux Server?

Features of Stateless Linux Server

  1. Stores the prototype of every system.
  2. Stores the snapshot was taken.
  3. Stores the home directories.
  4. Uses LDAP, which contains the information about which snapshot should run on which system.

Q.11 How do you run a command for a limited time?

Use this command: timeout 10s ./script.sh

# Restart every 30 minutes

while true; do timeout 30m ./script.sh; done

Read More:   15 Best Offshore Software Development Companies In The World

Q.12 How do you run the command every time a file is modified?

Use this command to do:

while inotifywait -e close_write document.tex

do

make

done

Q.13 How do you list the contents of tar.gz and extract only one file?

use these commands:

  • tar of file.tgz
  • tar xf file.tgz filename

Q.14 How do you get the full path of a file in Linux?

Use this command: readlink -f file.txt

Q.15 How do you limit memory usage for commands?

  1. ulimit -Sv 1000       # 1000 KBs = 1 MB

2. ulimit -Sv unlimited  # Remove limit

Q.16 What is the difference between Linux and Windows?

Linux Windows
Linux is available for FREE It is paid software
It is an Open-Source operating system It is not an open-source OS
Linux customization is possible No customizations are available
It provides high-level security Can’t defend virus and malware attacks unless until it is paid
Primary partitioning and logical partitioning available to boot Booting is available while primary partitioning only
BackSlash separates directories The forward slash separates directories
File names are case particular Irrespective of the case while naming files

Q.17 What is the df command in Linux?

Users can use the df command to troubleshoot disk space issues. Here df stands for display free disk space.

df Command Example:

df -h

Q.18 What is a du command in Linux?

du command in Linux is used to retrieve more detailed information about which files use the disk space in a directory.

du Command Example:

  • $ du -sh /var/log/*
  • 1.8M  /var/log/anaconda
  • 384K  /var/log/audit
  • 4.0K  /var/log/boot.log
  • 0 /var/log/chrony
  • 4.0K  /var/log/cron
  • 4.0K  /var/log/maillog
  • 64K /var/log/messages

Q.19 What is the env command in Linux?

env command allows users to set or print the environment variables. During troubleshooting, users can find it useful for checking if the wrong environment variable prevents your application from starting.

env Command Example:

$ env

PYTHON_PIP_VERSION=9.0.1

HOME=/root

DB_NAME=test

PATH=/usr/local/bin:/usr/local/sbin

LANG=C.UTF-8

PYTHON_VERSION=3.4.6

PWD=/

DB_URI=mongodb://database:27017/test

Q.20 What is ps command in Linux?

The ps command displays process status. Use this ps command to determine a running application or confirm an expected process.

ps Command Example:

$ ps -ef

$ ps -ef | grep tomcat

Q.21 What is the grep command in Linux?

grep searches file patterns. If you are looking for a specific pattern in the output of another command, grep highlights the relevant lines. Use this grep command for searching log files, specific processes, and more.

grep Example: 

$ cat tomcat.log | grep org. apache.Catalina.startup.Catalina.start

12-Jan-2018 17:08:35.542 INFO [main] org.apache.Catalina.startup.Catalina.start Server startup in 681 ms

Q.22 What is the cat command in Linux?

In Linux cat command concatenates and prints files. Users might issue cat to check the contents of your dependencies file or to confirm the version of the application that you have already built locally.

cat Example:

$ cat requirements.txt

flask

flask_pymongo

Q.23 What is the tail command in Linux?

The tail command displays the last part of a file. Generally, users don’t need every logline to troubleshoot. Instead, you want to check what your logs say about the most recent request to your application.

tail Example:

$ tail -n 100 /var/log/httpd/access_log

Q.24 Why is Linux considered more secure than other operating systems?

Linux is an open-source operating system, nowadays it is rapidly growing in the technology market. We have a few reasons why Linux is more secure than other OS.

  • The perk of accounts: Linux allows only a few users to access the system. Thus, the virus cannot attack the whole system, it may cause only a few files in the system.
  • Strong Community: Linux users first accomplished the files before they open. So they can save their systems from vulnerabilities.
  • Iptables: Iptables are used by Linux because it checks the security circle of the system.
  • Different Working Environment: Linux system has different working environments like Linux Mint, Debian, Arch, and many more, these working environments protect from the virus.
  • Recording in Linux: It maintains log history because later it can view the details of the system files easily.
  • Few User: Linux users are less compared to others, due to this security will be more.

Q.25 Explain the work of the Ctrl+Alt+Del key combination on the Linux operating system?

In Linux, the Ctrl+Alt+Del key is used to restart the computer, and it does not display any confirmation message before rebooting the system.

Q.26 What is meant by internal commands and external commands?

  • Internal Commands: Commands directly run by the shell are known as internal commands and there is no separate process to run the commands.
  • External Commands: Commands which are run by the kernel are known as external commands and every single command has its own unique process id.

Q.27 Differentiate between BASH and DOS?

Difference between Bash and Dos

Bash Dos
Commands are case sensitive commands are not case sensitive
Backward slash(/) represents directories separator ‘/’ represents command arguments
Forward slash ‘’ represents escape character ‘’ represents directories separator
Does not follow conventions naming in files Follow naming convention in files

Q.28 What are the features of the Linux operating system?

Following are the features of the Linux Operating System

  • Portable: Software can work on different types of hardware in the same way. It can carry easily in pen drives and memory cards.
  • Open Source: Source code available for free, and its community-based development project.
  • Multi-User: Multiple users can use ram, applications and run programs at the same time.
  • Multiprogramming: Multiple programs or applications can run at the same time.
  • Shell: It has a special interpreter program where you can execute programs and commands of the system.
  • Security: It provides authentication, authorization, and encryption to provide security to the data.

Q.29 Why do we use LINUX?

We are many reasons, in that few important reasons are listed out. Following are

  • High Stability: It is very stable and does not lead to crashes, it runs fastly as it is when it is installed first.
  • Security: It is a dependable server, that offers high security to the user. Using Linux on your system it is easy to avoid viruses and malware. The attacker cannot change any changes in the system until the user is logged in as the root user.
  • Easy to Operate: Linux is easy to operate and we can install it easily onto the system because all the variants of Linux have their own software repositories. You can update the system periodically with just a few clicks or you can set automatic updation.
  • Hardware Compatibility: Linux can use on any hardware, it doesn’t have any hardware restrictions. It uses efficiently all system resources.
  • Open Source: The source code is available as it is under Free and Open Source Software(FOSS).

Q.30 Enlist some Linux distributors (Distros) along with their usage?

We have so many Linux Distributors, among them, we discuss a few important ones.

  • Linux Mint: It is stable and robust. Linux Mint uses mate desktop and cinnamon.
  • Debian: It stands for robustness, stability, and a well-oiled release cycle. It is user-friendly. Debian version 8 will be replaced by version 9.
  • Ubuntu: It is available for both desktop and server editions and is based on Debian.
  • openSUSE: It is a good choice for new users and existing users.
  • Manjaro: It gives a pleasant experience for new and experienced users.

In a Nutshell

Linux is a type of operating system that runs on any computer effectively. Linux is not just free, it’s also open-source, which means that it has no restrictions on how its code can be used or modified.

We all know that Linux is software that helps one use and understand computers better. This article talks about how to carry out an interview for a person who is knowledgeable in Linux. Linux has been known for its stability and speed. A Linux interview question may be a good idea to help you decide whether it is the right operating system for your needs.

These Linux interview questions and answers article will give you some insight into what to expect when interviewing for a Linux position. You’ll find out more about the software, the history of the operating system, and what kind of certifications you might be able to get if you decide to go down that path!

Source: InApps.net

List of Keywords users find our article on Google:

linux interview questions
kbs1 ecommerce
linux troubleshooting interview questions
advanced linux interview questions
basic linux interview questions
linux os interview questions
linux basic interview questions
linux storage interview questions
top linux interview questions
interview questions on linux commands
good linux interview questions
top linux questions
basic linux commands interview questions
essential linux programs
top 50 operating system interview questions
linux advanced interview questions
interview questions on linux
interview questions linux
troubleshooting in linux interview questions
Rate this post
As a Senior Tech Enthusiast, I bring a decade of experience to the realm of tech writing, blending deep industry knowledge with a passion for storytelling. With expertise in software development to emerging tech trends like AI and IoT—my articles not only inform but also inspire. My journey in tech writing has been marked by a commitment to accuracy, clarity, and engaging storytelling, making me a trusted voice in the tech community.

Let’s create the next big thing together!

Coming together is a beginning. Keeping together is progress. Working together is success.

Let’s talk

Get a custom Proposal

Please fill in your information and your need to get a suitable solution.

    You need to enter your email to download

      Success. Downloading...