Theoretical Questions

1. What is Linux?

Ans. Linux is an Open-Source Operating System based on Unix. Linux was first introduced by Linus Torvalds. The main purpose of Linux was to provide free and low-cost Operating Systems for users who could not afford Operating Systems like Windows or iOS or Unix. Users can modify and create variations of the source code, known as distributions, for computers and other devices. The most common use is as a server, but Linux is also used in desktop computers, smartphones, e-book readers and gaming consoles, etc.

2. What are the features of Linux?

Ans.

  • Free and Open Source: It is freely and easily available to anyone.
  • Free distribution services: CentOS, OpenSUSE, etc.
  • Less maintenance.
  • Robust and Adaptable: Linux can operate for prolonged periods without crashing and is considered to have very much immune to security threats.
  • More secure: It is more secure as it provides security using authentication features like password authentication, security auditing, and file system access control.
  • Multiprogramming System: More than one can function or an application can run simultaneously.
  • Application Support: It has its own software repository i.e., place or storage location from where software can be retrieved so that users can download and install applications.
  • Supports customized keywords: There are many different languages used throughout the world, therefore Linux supports the installation of multiple languages keyboards.
  • GUI (Graphical User Interface): It provides an interface for users to interact with the system and allows to use of GUI applications such as VLC, Firefox, etc.

3. What are the basic elements or components of Linux?

Ans.

  • 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. 

4. What is Operating System?

Ans. An Operating System (OS) is software that acts as an interface between computer hardware components and the user. Every computer system must have at least one operating system to run other programs. Applications like Browsers, MS Office, Notepad Games, etc., need some environment to run and perform their tasks.

The OS helps you to communicate with the computer without knowing how to speak the computer’s language. It is not possible for the user to use any computer or mobile device without having an operating system.

5. What is Linux Kernel?

Ans. The Linux Kernel is a low-level systems software whose main role is to manage hardware resources for the user. It is also used to provide an interface for user-level interaction.

6. What is a shell and what types of shell?

Ans. A Shell provides you with an interface to the Unix system. It gathers input from you and executes programs based on that input. When a program finishes executing, it displays that program’s output.

Shell is an environment in which we can run our commands, programs, and shell scripts. There are different flavors of a shell, just as there are different flavors of operating systems. Each flavor of the shell has its own set of recognized commands and functions.

Shell Types

In Unix, there are two major types of shells −

  • Bourne shell − If you are using a Bourne-type shell, the $ character is the default prompt.
  • C shell − If you are using a C-type shell, the % character is the default prompt.

The Bourne Shell has the following subcategories −

  • Bourne shell (sh)
  • Korn shell (ksh)
  • Bourne Again shell (bash)
  • POSIX shell (sh)

The different C-type shells follow −

  • C shell (csh)
  • TENEX/TOPS C shell (tcsh)

7. What is BASH?

Ans. BASH stands for Bourne Again SHell. It was written by Steve Bourne as a replacement for the original Bourne Shell (represented by /bin/sh). BASH combines all the features from the original version of Bourne Shell, plus additional functions to make it easier and more convenient to use. It has since been adapted as the default shell for most systems running Linux.

8. What is the difference between Linux and Unix?

Related Article: Difference between Linux and Unix

ParameterLinuxUnix
PriceBoth free distributions and paid distributions are available.Different levels of UNIX have a different cost structure
Target UserEveryone (Home user, Developer, etc.)Mainly Internet Server, Workstations, Mainframes.
File System SupportExt2, Ext3, Ext4, Jfs, ReiserFS, Xfs, Btrfs, FAT, FAT32, NTFS.jfs, gpfs, hfs, hfs+, ufs, xfs, zfs,vxfs.
GUIKDE and GnomeCommon Desktop Environment
Viruses listed60-10080-120
Bug Fix SpeedFaster because Linux is Community drivenSlow
PortabilityYesNo
ExamplesUbuntu, Fedora, Red Hat, Kali Linux, Debian, Archlinux, Android, etc. OS X, Solaris, All Linux

9. What is a bootloader?

Ans. A bootloader, also known as a boot program or bootstrap loader, is special operating system software that loads into the working memory of a computer after start-up. For this purpose, immediately after a device starts, a bootloader is generally launched by a bootable medium like a hard drive, a CD/DVD, or a USB stick. The boot medium receives information from the computer’s firmware (e.g. BIOS) about where the bootloader is. The whole process is also described as “booting”.

10. What is Lilo?

Ans. LILO is a boot loader for Linux. It is used mainly to load the Linux operating system into the main memory so that it can begin its operations.

11. Difference between Lilo and Gurb?

ParameterLiloGurb
Full-FormLILO stands for Linux LoaderGurb stands for Grand unified boot loader
Command InterfaceLILO has no interactive command interfaceGurb has an interactive command interface
BootingLILO does not support booting from a networkGurb does support booting from a network
Boot LoaderLILO only loads Linux and other boot loadersGRUB loads a large number of OS

12. Describe the root account?

Ans. The root account is like a systems administrator account and allows you full control of the system. Here you can create and maintain user accounts, assigning different permissions for each account. It is the default account every time you install Linux.
The Id of root is by default 0.

13. What is CLI?

Ans. CLI is short for Command Line Interface. This interface allows the user to type declarative commands to instruct the computer to perform operations. CLI offers greater flexibility. However, other users who are already accustomed to using GUI find it difficult to remember commands including attributes that come with it.

14. What is GUI?

Ans. GUI, or Graphical User Interface, makes use of images and icons that users click and manipulate as a way of communicating with the computer. Instead of having to remember and type commands, the use of graphical elements makes it easier to interact with the
the system, as well as adding more attraction through images, icons, and colors.

15. What are daemons?

Ans. Daemons are services that provide several functions that may not be available under the base operating system. Its main task is to listen for service requests and at the same time to act on these requests. After the service is done, it is then disconnected and waits for further requests.

16. What is systemd?

Ans. systemd is a Linux initialization system and service manager that includes features like on-demand starting of daemons, mount and automount point maintenance, snapshot support, and processes tracking using Linux control groups. systemd provides a logging daemon and other tools and utilities to help with common system administration tasks.

17. What is a swap space?

Ans. Swap space is a certain amount of space used by Linux to temporarily hold some programs that are running concurrently. This happens when RAM does not have enough memory to hold all programs that are executing. We usually assign half of the RAM size to the Swap partition. if RAM is 16GB then Swap will be 8GB.

Related Article: What is Swap Partition and how to create it on Linux

18. What is a typical size for a swap partition under a Linux system?

Ans. The preferred size for a swap partition is twice the amount of physical memory {RAM} available on the system. If this is not possible, then the minimum size should be the same as the amount of memory installed.

19. Explain file permission in Linux?

Ans. There are 3 kinds of permission in Linux:

  1. Read: Allows a user to open and read the file
  2. Write: Allows a user to open and modify the file
  3. Execute: Allows a user to run the file.

You can change the permission of a file or a directory using the chmod command. There are two modes of using the chmod command:

  1. Symbolic mode
  2. Absolute mode

Symbolic mode

The general syntax to change permission using Symbolic mode is as follows:

$ chmod <target>(+/-/=)<permission> <filename>

where <permissions> can be r: read; w: write; x: execute.

<target> can be u : user; g: group; o: other; a: all

'+' is used for adding permission

'-' is used for removing permission

'=' is used for setting the permission

For example, if you want to set the permission such that the user can read, write, and execute it and members of your group can read and execute it, and others may only read it.

Then the command for this will be:

$ chmod u=rwx,g=rx,o=r filename

Absolute mode

The general syntax to change permission using Absolute mode is as follows:

$ chmod <permission> filename

The Absolute mode follows octal representation. The leftmost digit is for the user, the middle digit is for the user group and the rightmost digit is for all.

Below is the table that explains the meaning of the digits that can be used and their effect.

0No permission– – –
1Execute permission– – x
2Write permission– w –
3Execute and write permission: 1 (execute) + 2 (write) = 3– wx
4Read permissionr – –
5Read and execute permission: 4 (read) + 1 (execute) = 5r – x
6Read and write permission: 4 (read) + 2 (write) = 6rw –
7All permissions: 4 (read) + 2 (write) + 1 (execute) = 7rwx

For example, if you want to set the permission such that the user can read, write, and execute it and members of your group can read and execute it, and others may only read it.

Then the command for this will be:

$ chmod 754 filename

Related Article: Linux File & Directory Permission

Related Article: Linux File & Directory Advance Permission

20. What are inode and process id?

Ans. An inode is the unique name given by the operating system to each file. Similarly, Process id is the unique id given to each process.

21. What are the process states in Linux?

Ans. The process states are as follows:

  • Ready: The process is created and is ready to run
  • Running: The process is being executed
  • Blocked or wait: Process is waiting for input from the user
  • Terminated or Completed: Process completed execution, or was terminated by the Operating System
  • Zombie: Process terminated, but the information still exists in the process table.

22. What Is a File system in Linux?

Linux file system stores and handles the data. Without a file system, it cannot know where the file starts from and where the file ends.

Related Article: What is Linux? Distributions, History, and File System

23. Explain different file system types in Linux?

In Linux, there are many file systems:

Ext, Ext2, Ext3, Ext4, JFS, XFS, btrfs, ufs, autofs, devpts, ntfs and swap.

24. 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.

Related Article: What is LVM Partition and how to create it on Linux

25. What is umask?

unmask stands for user file creation mode. When the user creates any file, it has default file permissions. So unmask will specify a few restrictions to the newly created file (it controls the file permissions).

umask [-S] [mask]

26. What is network bonding in Linux?

Network Bonding is a process of combining more than two network interfaces to form a single network interface. It offers performance improvement and redundancy by increasing network throughput and bandwidth.

No need to worry if one interface is down or unplugged because the other will work. The behaviour of the bonded interface depends on the bonding method. 

27. Why /etc/resolv.conf and /etc/hosts files are used?

/etc/resolv.conf: It is used to configure DNS name servers as it contains the details of the nameserver i.e., details of your DNS server. The DNS server is then used to resolve the hostname of the IP address. 

/etc/hosts: It is used to map or translate any hostname or domain name to its relevant IP address.

28. Write the difference between Soft and Hard links?

Hard Links: It is a special kind of file that points to the same underlying inode as another file. It can be referred to as an additional name for an existing file on Linux OS. A total number of hard links for a file can be displayed using the “ls -l” command. Such links cannot be used across file systems. Hard links can be created using the following command: 

$ ln [original filename] [link name] 

Soft Links: It is also termed a symbolic Link. Soft links are kinds of files that usually point to another file. It does not include any amount of data in the target file and simply points to another entry anywhere in the file system. Such links can be used across file systems. Soft links can be created using the following command: 

$ ln -s [original filename] [link name] 


Scenario-Based Questions

1. How to copy a file in Linux?

You can use the cp command to copy a file in Linux. The general syntax is:

$ cp <source> <destination>

Suppose you want to copy a file named questions.txt from the directory /new/linux to /linux/interview, then the command will be:

$ cp questions.txt /new/linux /linux/interview

2. How to terminate a running process in Linux?

Every process has a unique process id. To terminate the process, we first need to find the process id. The ps command will list all the running processes along with the process id. And then we use the kill command to terminate the process.

The command for listing down all the processes:

$ ps

Suppose the process id of the process you want to terminate is 3849, then you will have to terminate it like this:

$ kill 3849

3. How to rename a file in Linux?

There is no specific command to rename a file in Linux. But you use the copy or move command to rename the file.

Using the Move command

$ mv <oldname> <newname>

Using the Copy command

$ cp <oldname> <newname>

And then delete the old file.

$ rm <oldname>

4. How to write the output of a command to a file?

You can use the redirection operator (>) to do this.

Syntax: $ (command) > (filename)

5. How to see the list of mounted devices on Linux?

By running the following command:

$ mount -l

6. How to find where a file is stored in Linux?

You can use the locate command to find the path to the file.

Suppose you want to find the locations of a file name sample.txt, then your command would be:

$ locate sample.txt

7. How to find the difference in two configuration files?

You can use the diff command for this: 

$ diff abc.conf xyz.conf

8. Write a bash script to delete all the files in the current directory that contains the word “linux”.

for i in *linux*; do rm $i; done

9. How would you create a text file without opening it?

The touch command can be used to create a text file without opening it. The touch command will create an empty file. The syntax is as follows:

$ touch <filename>

Suppose you want to create a file named sample.txt, then the command would be:

$ touch sample.txt

10. How would you delete a directory in Linux?

There are two commands that can be used to delete a directory in Linux.

  • rmdir
$ rmdir <directory name>
  • rm -rf 
$ rm -rf <directory name>

Note: The command rm -rf should be used carefully because it will delete all the data without any warnings. 

11. How would you schedule a task in Linux?

There are two commands to schedule tasks in Linux: cron and at.

The cron command is used to repeatedly schedule a task at a specific time. The tasks are stored in a cron file and then executed using the cron command. The cron command reads the string from this file and schedules the task. The syntax for the string to enter in the cron file is as follows:

<minute> <hour> <day> <month> <weekday> <command>

Suppose you want to run a command at 4 pm every Sunday, then the string would be:

0 16 * * 0 <command>

The at command is used to schedule a task only once at the specified time.

Suppose you want to shut down the system at 6 pm today, then the command for this would be:

$ echo "shutdown now" | at -m 18:00

12. Suppose you try to delete a file using the rm command and the deletion fails. What could be the possible reason?

  • The path specified to the file or the file name mentioned might be wrong
  • The user trying to delete the file might not have permission to delete the file.

13. How do you look at the contents of a file named sample.z?

The .z extension means that the file has been compressed. To look at the contents of the compressed file, you can use the zcat command. Example:

$ zcat sample.z

14. How to copy files to a Floppy Disk safely?

Follow these steps to copy files to a Floppy Disk safely:

  1. Mount the floppy disk
  2. Copy the files
  3. Unmount the floppy disk

If you don’t unmount the floppy disk, then the data might become corrupted. 

Related Article: Linux Fundaments and Basic Commands

15. How to identify which shell you are using?

Open the terminal and run:

$ echo $SHELL

This will print the name of the Shell being used. 

16. How can you log in to another system in your network from your system?

SSH can be used for this. The Syntax is as follows:

ssh <username>@<ip address>

Suppose you want to login into a system with IP address 192.168.7.10 as a user “root”, then the command would be:

$ ssh root@192.168.7.10

17. How would you open a file in read-only mode using the vim editor?

$ vim -R <filename>

18. How would you search for a specific Employee ID in a file using the vim editor?

$ vim +/<employee id to be searched> <filename>

19. How to jump to a particular line in a file using vim editor?

$ vim +<line number> <filename>

20. How do you sort the entries in a text file in ascending order?

This can be done using the sort command.

$ sort sample.txt

21. What is the export command used for?

The export command is used to set and reload the environment variables. For example, if you want to set the Java path, then the command would be:

$ export JAVA_HOME = /home/user/Java/bin

22. How do you check if a particular service in running?

$ service <servicename> status

23. How do you check the status of all the services?

$ service --status-all

24. How do you start and stop a service?

To start:

$ service <servicename> start

To stop:

$ service <servicename> start

25. How to check the default route and routing table?

To display the default route and routing table, we use the following commands.

$ route-n

$ nestat-rn

$ ip 

26. How to check which ports are listening in my Linux Server?

We have two commands to check which ports are in listening in Linux Server. Following are the two commands 

# netstat --listen
# netstat -l
# lsof -i -n -P | grep LISTEN

27. How to change the default run level in Linux?

To change the default run level in Linux use the init command. 

This Post Has 10 Comments

  1. codeiherbdaUtt

    iherb discount promo code

  2. MississippiLead

    Society blog

  3. 10รับ100ล่าสุด รวมค่าย

    I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.

  4. slot.pgzeed

    This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!

  5. Aniyah Ava Ariana Huber

    Keep up the amazing work!

  6. pg pgslot.fish

    I really like reading through a post that can make men and women think. Also, thank you for allowing me to comment!

  7. โปร50รับ100

    Awesome! Its genuinely remarkable post, I have got much clear idea regarding from this post

  8. โปร 50 รับ 100

    This is my first time pay a quick visit at here and i am really happy to read everthing at one place

Leave a Reply