December 1, 2023

Part-7: Basic 10 Linux Interview Questions and Answers

In this article, we’ve included 7th set of 10 basic Linux Interview Questions and detailed answers that will help candidates prepare for the Linux interview and get the best job in the IT industry.

These Linux interview questions and answers will be useful for both freshers and experienced professionals at any level.

Some of the questions are for advanced Linux professionals, however, beginners or fresher can easily understand the answers and explanations described below.

Q.1) What are the basic components of Linux?

Just like other operating systems, Linux operating system consist of five major components:

  • Hardware: Peripheral devices such as RAM, HDD, CPU together constitute the Hardware layer for the Linux operating system.
  • Kernel: The Linux kernel is the main component of a Linux operating system, which is the bridge of communication between a computer’s hardware and the user processes. It communicates between them and managing the entire functioning of the Linux system.
  • Shell: Shell is a Linux interpreter which is used to execute user commands.
  • System Library: System libraries are special programs, which are used to implement the functionality of the operating system.
  • System Utilities: It provides the functionalities of an operating system to the user.

Q.2) What is Linux Foreground processes

Processes that require a user intervention are called foreground processes. A foreground process is any command or program that you run in the terminal and you have to wait for its completion.

If it runs for a long time, you will be not able to start any other processes until the current program finishes.

For example, When you run the below command that started runs in foreground by default, receives input from the keyboard, and sends output to the screen.


Q.3) What is Linux Background processes

Processes that run independently without the need for user interaction are referred to as background processes.

This can be placed in the background, which allowing the user to access the terminal, and continue to work, rather than waiting for a long job to finish. To run a process in the background, append an ampersand (&) at the end of the command name.

command &

How do I run a Linux command in the background?

To run a process in the background, add the ampersand symbol ‘&’ at the end of the command name as shown below:

By default, the background process will continue to write messages to the terminal where you started the command, you can suppress the ‘stdout’ and ‘stderr’ messages using the following syntax:

ping > /dev/null 2>&1 &

[1] 24497

How can I check the running background jobs?

Use the Jobs command to display the status of background work in the current shell session.

jobs -l

[1]+ 24497 Running               ping > /dev/null 2>&1 &

Q.4) What is man command in Linux?

A man page (stands for manual page) is a built-in manual for using Linux commands. It displays the user manual of any command that we can run on the terminal.


Linux man Command Syntax

The basic man command syntax is:

man [option] [section number] [command name]

For example, to view man page of free command, run:

man free

Man: find all matching manual pages (set MAN_POSIXLY_CORRECT to avoid this)
 * free (1)
   free (3)
   free (3p)
Man: What manual page do you want?

Q.5) What is the use of the command help option in Linux?

The man command displays detailed information about a Linux command, but if you want to see a brief overview of the options available for the Linux command, use the '--hlep' or '-h' option in any Linux command.

df --help

Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all             include pseudo, duplicate, inaccessible file systems
  -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,
                           '-BM' prints sizes in units of 1,048,576 bytes;
                           see SIZE format below
  -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)
  -H, --si              print sizes in powers of 1000 (e.g., 1.1G)
  -i, --inodes          list inode information instead of block usage

Q.6) What is absolute path in Linux

The term “path” refers to the unique location of a file or directory in a file system. Absolute path is the path of a file or directory from the root directory i.e. from ‘/’.

For example, to view the ‘FOSSTechi.txt’ file using the absolute path, run:

ls -lh /home/linuxgeek/Documents/FOSSTechi.txt

-rw-r--r-- 1 linuxgeek users 25 Sep 4 02:06 /home/linuxgeek/Documents/FOSSTechi.txt

Q.7) What is relative path in Linux

Relative path is the path of a file or directory from the present working directory (pwd), not ‘/’.

For example, to view the ‘FOSSTechi.txt’ file using the relative path, run:

ls -lh Documents/FOSSTechi.txt

-rw-r--r-- 1 linuxgeek users 25 Sep 4 02:06 Documents/FOSSTechi.txt

Q.8) What is Linux cron job?

The cron daemon is a utility that popularly known as cron job or crontab. It is used to execute a task (command or script) repeatedly at a specified time by reading the crontab (cron tables). It can be monthly, weekly, daily, hourly, every minute, even every second.

cron job is very useful to perform regular tasks such as regular backups, daily scans, /tmp directory cleanup, and restarting the system at a given time.

The Linux crontab has ‘six’ fields, the first ‘five’ fields (1-5) indicate the date and time of execution, and the ‘6’th’ field is used to execute a command or script.

 .-----------------> Minute (0-59)
 |    .--------------> Hour (0-23)
 |    |    .-----------> Day of Month (1-31)
 |    |    |    .--------> Month (1-12) or (jan,feb,mar,apr ...dec)
 |    |    |    |    .-----> Day of Week (0-6) (Sunday=0 or 7) or (sun,mon,tue,wed,thu,fri,sat)
 |    |    |    |    |    .--> Command to be executed
 |    |    |    |    |    |
 *    *    *    *    *    *

How do I check my cron jobs?

To list the logged-in user’s crontab entry, run:

$ crontab -l

Q.9) What is anacron in Linux?

anacron command is used to execute commands periodically, which is similar to cron. But this tool is specifically designed for a system (Laptop & Desktop) that is not running 24×7.

For instance, you have scheduled a job at ’01 AM’ midnight using crontab, and if your system is powered off at the time then the backup script will not be executed.

This is where anacron comes into picture. It is make sure that the next time you power on the desktop/laptop again, the backup script will be executed.

anacron configuration file is located at ‘/etc/anacrontab’

There are ‘four’ fields for anacron job, and the format is listed below:

$ cat /etc/anacrontab

period   delay   job-identifier   command
   |        |           |             |
   |        |           |             : 
   |        |           |             '--------> command or shell script to be executed.
   |        |           :
   |        |           '--------> It's a anacron job-id, which is used to name the timestamp file created in /var/spool/anacron
   |        :     
   |        '--------> The number of minutes anacron should wait before executing the job (delay in minutes)
   '--------> Specifies how frequently the job should be executed, in days (@daily, @weekly, @monthly)

Q.10) What is the difference between cron and anacron?

The below table describes the difference between the cron and anacron.

1It is a daemon that runs scheduled tasksanacron itself doesn’t run as a service/daemon, but cron checks if anacron is available for the daily, weekly and monthly tasks.
2Minimum granularity is minute and jobs can be scheduled for every minute.Minimum time frame is 1 day so, you can’t run hourly jobs with anacron.
3Anybody can schedule a job if it is not banned by the super user.Only super user can schedule jobs.
4It’s suitable for Linux serversIt’s suitable for Linux Laptop and Desktops
5It is designed for systems that are up and running 24×7. If a job is scheduled and the system is down at that time, the job will not be executed.It is designed for systems that are not running 24×7. If the system is not available during the scheduled job, the job will be executed when the system comes back up.


In this guide, we’ve included the most frequently asked 7th set of 10 basic Linux Interview Questions and detailed answers for your reference purpose and we hope it will be very useful.

If you have any questions or feedback, feel free to comment below.

Leave a Reply

%d bloggers like this: