Thursday, 2 May 2024

Linux Interview Questions & Answers

 

 What do you understand by Linux?

A UNIX-based operating system is Linux. It was first introduced by Linus Torvalds. It is an open source operating system that was created to offer computer users a free and affordable operating system.

 What distinguishes UNIX and Linux from each other?

Linux is a free, open-source, and non-propriety operating system for general use while UNIX was initially developed as a proprietary operating system for Bell Laboratories, who later released their commercial version.

 What is LILO

A Linux boot loader is called LILO. It is used to start the Linux operating system's activities by loading it into the main memory.

 Explain features of Linux?

Free and Open Source: Anyone can access it without charge or difficulty.
Robust and Flexible: Linux is thought to be very resistant to security threats and can run continuously for extended periods of time without crashing.
More safe: It offers security through password authentication, security auditing, and file system access control, making it more secure.
Multiple programmes can work together or run simultaneously on a multiprogramming system.
Application Support: It has a dedicated software repository, which is a site or point of storage where users can download and install apps.
Supports customizable keywords: Because there are so many different languages spoken throughout the world, Linux allows for the installation of keyboards for numerous languages.
GUI (Graphical User Interface): It enables the usage of GUI programmes like VLC, Firefox, etc. and offers users a way to interact with the system.

 What fundamental parts or elements make up Linux?

Linux typically consists of the following five fundamental parts or elements:
The kernel, which is regarded as the foundation or core of Linux, is often in charge of all key OS operations including process and device management.
System Library: These are specialised programmes or functions that allow system utilities or application software to access kernel-level functionality without the need for coding. It merely serves to implement the OS's features.

System Utility: These utility applications are in charge of carrying out specific, individual-level functions. They are thought to be more trustworthy and provide users control over the machine.

Hardware: This refers to actual, tangible objects such a mouse, keyboard, monitor, CPU, etc.
We may execute our commands, shell scripts, and programmes in the shell environment. It is an interface between the user and the kernel that shields the user from the user's complexity of the kernel's functions. It is employed to carry out directives.

 Explain BASH?

A command language interpreter is essentially what BASH (Bourne Again Shell) is. It can be used in place of Bourne Shell and was created by Brian Fox for the GNU operating system. Although it is comparable to Bourne Shell, it has several extra capabilities like command-line editing that make it simpler and more practical to use. On the majority of Linux installations, it serves as the default user shell. Essentially, it is a non-compiled, interpreted process that can also operate in the terminal window. Additionally, it has the ability to read commands from shell scripts.

 Explain CLI

Command language interpreter is known as CLI. It engages in computer programme interaction when the user issues text-line commands. It also communicates with computer terminals; the interface accepts text lines and transforms them into instructions for the operating system.

 What benefit does open source offer?

One of the first open-source technologies was Linux, to which many programmers contributed software that was totally accessible to consumers. As a result, you could download the file and modify the code whatever you pleased. It offers users a variety of options and improved security.

 What do you mean by Swap space?

When the RAM is not large enough to accommodate the processes, Linux uses additional space known as swap space to hold concurrently running programmes. A programme runs from memory (RAM) so that the processor can swiftly fetch data. If you have more running programmes than the RAM can accommodate, they are placed in the Swap Space. Now, the processor will search the RAM and the Swap Space for information. Linux makes use of swap space as an addition to its RAM.

 What are the file permission in Linux?

There are 3 types of access
enables the user to access and read the file.
Allows the user to access and alter the file.
Allows a user to open and run the file.

Explain different types of modes used in VI editor?

The default text editor that is often included with the majority of Linux operating systems is called VI editor (Visual Editor). In the VI editor, there are generally three different sorts of modes, as listed below:
The default mode for vi editors is called command mode or regular mode. Typically, commands that execute specified or specialised vi functions are typed in this way. Press [esc] to transition into this mode from the Insert mode. Simply said, it enables you to view the material.
Text editing and text entry are both possible in the insertion mode/edit mode. Press [esc] to transition into this mode from the command mode. Simply put, it allows you to erase or add text or information.
Ex Mode/Replacement Mode: This mode is frequently utilised to store files and carry out command execution. Basically, it runs files with various settings. By pressing [:], one can access this mode. Simply put, it allows you to replace text or other information.

 What do you mean by environmental variables?

They are dynamic values that have an impact on how computer programmes run. Every operating system has them, and they come in a variety of sorts. They provide data regarding system behaviour and can be generated, changed, saved, and deleted.

 What is the longest filename that can be used under Linux?

Under Linux, a filename can only be 255 bytes long.

What do you mean by virtual desktop?

Users can use the desktop in ways that go beyond the actual boundaries of the screen thanks to a feature called Virtual Desktop. In short, Virtual Desktop expands the capabilities of the physical screen by creating a virtual one.

Virtual Desktop can be implemented in one of two ways:
Switching Desktops
Oversized Desktops

Switching Desktops: You can build distinct virtual desktops to run programmes in the Switching Desktops scenario. In this scenario, each virtual desktop will function as a separate desktop, and the apps running on each of these desktops are only accessible to people who are currently logged into that desktop.
Oversized Desktops: Instead of providing a separate virtual desktop, oversized desktops let the user pan and browse around a desktop that is bigger than the actual screen.

 What do you mean by daemons ?

A daemon is a computer software that runs in the background to offer features that might not be present in the operating system's core functionality. Typically, daemons are employed to manage services in the background without having direct access to interactive users. Daemons are designed to handle recurring requests and then route them to the proper applications for execution.

 Explain grep command?

Global Regular Expression Print is referred to as Grep. The grep command uses regular expression-based pattern matching to find specific content within a file.

Syntax: grep [options] pattern [files]

 Describe ls command?

To view a list of the files in a given directory, use the ls command.

 What are the Linux process states?

The following are the process states:
The procedure has been created and is prepared to start.
Running: The operation is being carried out.
Block or hold off: The process is awaiting user input.
Process execution was terminated by the operating system or reached its conclusion.
Zombie: Although the process was ended, the data was still present in the process table.

 What is a Latch?

A latch is a timing-controlled temporary storage device that can either store 0 or 1. A Latch is primarily used to store state information and has two stable states (high output, or 1, and low output, or 0). As long as it is switched on, a latch can store one piece of data.

 What is Microprocessor?

A microprocessor is a machine that carries out commands. It is a single-chip device that retrieves, decodes, and executes instructions from memory. A microprocessor can do the following three basic tasks:
Addition, subtraction, multiplication, and division are examples of mathematical operations.
Transfer information between two locations in memory
Based on the circumstances, make decisions and then follow new, different instructions.

 How many disc partitions must be present for Linux to be installed?

There must be at least two partitions.

All files are kept on a single partition that serves as the local file system. Files from the OS, files from programmes and services, and user files are all included in this. The other partition, which serves as RAM's "extended memory," is used as swap space.

 Why is LVM necessary and what does it mean?

LVM (Logical Volume Management) is essentially a utility that gives the Linux kernel logical volume management. It is merely being introduced to simplify the management of physical storage devices. Allocating drives, striping, mirroring, and resizing logical volumes are all included. Increased abstraction, flexibility, and control are its key benefits. It merely enables flexible management of disc space. Resizing the file system's size online is very necessary. The "lvextend" and "lvreduce" commands in Linux can be used to increase or decrease the size of the LVM partition, respectively.

 What do you mean by “/proc” file system?

A pseudo or virtual file system called Proc offers access to the kernel data structure. Usually, it contains helpful details about currently active processes. Additionally, it can be used to modify a few kernel settings as they are being executed or run. It is also thought of as the kernel's command and information hub. Virtual files is the name given to every file in this directory.

 How may a running process in Linux be stopped?

Each process has its own individual process id. We must first locate the process id in order to end the process. The list of active processes produced by the ps command includes the process id. The process is then ended by using the kill command.

 What do you mean by netstat command?

The netstat (Network Statics) command can be used to view all network connections on a system and is typically used as a networking utility for configuration and troubleshooting. It merely offers a means of determining which connections are active and whether various TCP/IP features are functioning.

 What do you mean by ping command?

The ping (Packet Internet Groper) command for Linux is used to verify the status of a connection between a source and a destination. Simply said, this command is used to determine whether a network is accessible and whether the host can be reached. It can also be used to resolve names, check IP connectivity to a second TCP/IP device, and troubleshoot other connectivity difficulties. This command can be used to verify the computer's IP address and name.

 What does the Linux OS's sudo command stand for?

Sudo stands for "superuser do," with the root user of Linux serving as the superuser. This software allows users with superuser privileges to execute specific system commands at the root level on Linux/Unix-based systems.

 What does sar provide? Where the sar logs are stored?

The sar command in Linux is used to log and analyse a range of information pertaining to system activity. It collects, reports, or stores system activity information. SAR also enables the retrospective study of the load values for various sub-systems with performance issues (CPUs, memory, disks, interrupts, network interfaces, and so on). The workload sampled is said to be CPU-bound if CPU usage is close to 100%.

The /var/log/sa/sadd file, where the dd option denotes the current day, is where the sar command's log files are by default found.

 Explain the commands used in linux?

Working with files and directories in Linux can be done using the following five basic commands:
pwd: The acronym stands for "print working directory." This command is used to display the path to the active working directory. This command's syntax is $ pwd.
cd stands for "change directory." This command is used to switch the current working directory to the precise directory that is needed. This command's syntax is $ cd.
ls: ls stands for "list." This command allows us to display a complete list of the files and folders in the current working directory. This command's syntax is $ ls.
mkdir stands for "make directory." In Linux, we use this command to create folders.

 In Linux, how are shadow passwords distributed?

The command pwconv is used in Linux to provide the shadow passwords. The use of shadow passwords improves system security. This command changes all passwords in the /etc/passwd file to "x" and creates the file /etc/shadow.
The entries in the shadowed file that are not present in the main file are first deleted. The shadowed entries are then updated if the main file's password isn't 'x'. Also included are any missing shadowed entries. Passwords in the main file are finally changed with a "x." If the primary file is manually changed, these tools can be used for initial conversion as well as updating the shadowed file.

 What do you mean by puppet manifests?

The configuration information for each Puppet Node or Puppet Agent is stored in the Puppet Master in the native Puppet language. These details are known as puppet manifests and are expressed in a language the puppet can comprehend. These manifests have the.pp file extension and are written in Puppet code. For instance, we can use the Puppet Master to generate a manifest that instals Apache and creates a file on every Puppet Agent or slave that is linked to the Puppet Master.

What is root account?

The user name that by default has access to all files and commands is called root. The root user has access to several functions that a regular user does not, such as modifying file permissions and installing software.

Describe samba. Why is it necessary?

Samba is essentially a collection of open-source programmes. It supports a variety of operating systems, including OpenVMS, IBM, etc. Simply by offering Microsoft SMB capability, it is typically used to connect Linux machines to Microsoft network resources. For every client or user using the SMB (Server Message Block) or CIFS (Central Server Message Block) protocol, it offers more secure, reliable, and quick file and print services.

Explain difference between Linux and Unix?

Linus Torvalds created Linux, an operating system that is open-source and free to use, in 1991. It is specifically made to deliver free and inexpensive operating systems to users of personal computers. It supports networking effectively and has very minimal hardware requirements. Variants refer to several Linux releases.

Originally created in the 1960s, Unix is a closed-source operating system that was taken from the original AT&T Unix. Both the source code and the use of it are not open. Generally speaking, it can manage numerous users' actions at once. It is additionally specifically made to be more portable, multi-user, and capable of multitasking in a time-sharing scenario. Distros are different Unix distributions.

What distinguishes BASH and DOS from each other?

The Bourne shell, which is used on UNIX systems, is being developed into BASH (Bourne Again Shell), which is essentially a strong command shell and scripting language. It supports a variety of OS, and new features are frequently added. It has the ability to read and run scripts from files called shell scripts.
Disk Operating System, or DOS, is essentially an operating system that utilises a hard drive. It was the initial operating system that IBM-compatible computers utilised. In essence, it offers a command-line where users are free to issue commands as instructions.

What do Linux Process Management System Calls mean?

In Linux, the following commands are made by the process management system:
fork(): A method for starting a fresh process.
exec(): Run a fresh process.
wait(): holds off till the process is finished.
exit(): end the current process.
Get the Process ID using system calls: To determine the distinct process id, use getpid().
To identify the distinct parent process id, use getppid().

Why is LVM necessary?

Large Volume Management, or LVM, is a storage management tool. LVM partitions can be created, resized, and deleted by users. It improves control, flexibility, and abstraction. Existing storage devices are gathered into a group and distributed logical units using LVM.

What does Linux's load average mean?

As the name implies, load average refers to the average system load determined over a certain time period for Linux servers. The "top" and "uptime" commands can be used to determine the load average for Linux servers. The only purpose is to monitor system resources. It is shown as a decimal number beginning with 0.00. It reveals the amount of load the system has endured.

What are Process Id and INODE?

INODE: The operating system gives each file its individual name. Within a file system, every inode has a distinct inode number. It keeps track of numerous details about files under Linux, including ownership, file size, file type, access mode, links, and so forth.

Process Id (Identifier): Each process is given a special Id. Up until the process terminates, it is merely utilised to uniquely identify an active process throughout the system.

What is Shell Script?

As the name implies, a shell script is one created just for shell. Script in this context refers to a computer language used to run programmes. Simply put, it enables the execution of various commands entered into the shell. It generally aids in the development of intricate programmes with conditional statements, loops, and functions. In comparison to building large programmes, it is significantly faster and much easier to debug, and it can streamline routine automation procedures.

What are the various Linux network bonding modes?

Below is a list of the various network bonding modes available in Linux:
The round-robin policy is the foundation of mode-0 (balance-rr), which is the default mode. It has functions like load balancing and fault tolerance.
Active-backup mode 1: This mode is based on the active-backup policy. When other nodes fail in this, just one node responds or functions.
It establishes an XOR (exclusive-or) mode to provide load balancing and fault tolerance in mode 2 (balance-xor).
Broadcast policy underpins Mode 3 (broadcast). It establishes a broadcast mode to provide fault tolerance and can only be applied in certain circumstances.
Mode-4 (802.3ad): This mode, also known as Dynamic Link Aggregation mode, is based on the IEEE 802.3ad standard. It establishes a dynamic link aggregation mode compliant with IEEE 802.3ad and establishes aggregation groups that use the same speed and duplex parameters.
The mode-5 (balance-tlb) is often referred to as the adaptive TLB (Transmit Load Balancing). For load balancing and fault tolerance, it activates TLB mode. Traffic will be loaded based on each network slave in this mode.
Adaptive Load Balancing is another name for Mode-6 (balance-alb). For load balancing and fault tolerance, it sets ALB mode. It is not required to have any unique switch support.

Explain the difference between Soft and Hard links?

A unique type of file known as a "hard link" points to the same underlying inode as another file. It can be thought of as an additional name for a file that already exists on Linux OS. The "ls -l" command can be used to display the total number of hard links for a file. Such linkages are incompatible with other file systems.

Soft Links: Another name for them is symbolic Links. File types known as soft links typically point to another file. It merely directs to another entry somewhere in the file system and does not add any data to the destination file. Such linkages are applicable to several file systems.

Describe pipe?

A pipe is essentially a type of redirection in Linux that is used to deliver a command's output to another command for additional processing. It merely uses the results of one command as the input for another. It provides buffered I/O routines for asynchronous command execution.

Why is the tar command used?

To extract or generate an archived file, use the tar command.
The command would be as follows if you wanted to extract every file from the archive called sample.tar.gz:

$ tar -xvzf sample.tar.gz

How may a file be copied in Linux?

In Linux, you can copy a file using the cp command. This is the basic syntax:
$ cp <source> <destination>

How may a text file be created without being opened?

You can create a text file without opening it by using the touch command. A blank file will be created by the touch command. The following is the syntax:
$touch <filename >

How do you log in from your system to another system on your network?

SSH is suitable for this. This is how the syntax looks:
ssh <username>@<ip address>

No comments:

Post a Comment