1. What is Linux?
Linux is an open-source operating system based on UNIX. It was named after the founder “Linus Torvalds”. He introduced Linux with the primary goal to offer an operating system at a free or very reasonable price for users. It is based on the Linux kernel and is compatible with different hardware platforms such as Intel, MIPS, HP, IBM, SPARC, and Motorola hardware platforms. Linux’s mascot, a penguin named Tux, is another popular feature. Linux offers a user-friendly environment where they can easily modify and create variations in the source code.
2. Compare Linux with Windows.
3. What are the components of the Linux system?
There are three primary components of the Linux system which are explained below.
Kernel: The kernel is the most important component of Linux. It is in charge of the operating system’s primary functions. It is made up of a number of modules that interface directly with the hardware. Kernel offers the necessary abstraction for system or application programs to mask low-level hardware information.
System libraries: They are specialized functions or programs that allow application programs or system utilities to access Kernel capabilities. These libraries implement the majority of the operating system’s functionality and do not require kernel module code access permissions.
System Utility: Programs in the System Utility category are in charge of performing specialized, individual-level activities. They are more dependable and also provide users control over the computer.
4. What is LILO?
LILO (Linux Loader) is a boot loader for Linux. It is used to load Linux into memory and start the operating system. LILO can be configured to boot other operating systems as well. LILO is customizable, i.e., if the default configuration is not correct, it can be changed. The config file for LILO is lilo.conf. LILO is also a code snippet that loads PC BIOS into the main memory at the time of starting the computer system.
It handles the following tasks:
- Locating Linux kernel
- Identifying other supporting programs and loading them in memory
- Starting the kernel
The selection of various Kernel images and boot routines is supported by LILO. For this reason, it is known as the boot manager.
5. Suppose, you wish to print a file ‘draft’ with 60 lines on a page. What command would you use?
The command used for this purpose would be as follows:
pr -l60 draft
Note: The default page length when using pr is 66 lines. The -l option specifies a different length.
6. What is LD_LIBRARY_PATH?
LD_LIBRARY_PATH is an environment variable used for debugging a new library or a non-standard library. It is also used to identify the directories that need to be searched for; in order to do this, the path to search for the directories needs to be specified.
The variable can be set using the following:
setenv-LD_LIBRARY_PATH--$PATH
It is used to search for the shared objects/dynamic libraries by the operating system for extendable functionality at the runtime.
7. Name a service that you should disable (which acts both as web and FTP servers) on a Linux server.
The finger service should be disabled on a Linux server because a remote user can get important information about the system by using this command.
8. What does sar provide? Where are the sar logs stored?
In Linux, the sar command collects, reports, or saves system activity information, and it serves to log and evaluate a variety of information regarding system activity. With performance problems, sar also permits retroactive analysis of the load values for various sub-systems (CPUs, memory, disks, interrupts, network interfaces, and so on). If CPU utilization is near to 100 percent, the sampled workload is considered to be CPU-bound.
By default, the log files of the sar command are located at the /var/log/sa/sadd file, where the dd parameter indicates the current day.
9. How to check memory stats and CPU stats as a Linux Admin?
Using the free and vmstat commands, we can display the physical and virtual memory statistics, respectively. With the help of the sar command, we can see the CPU utilization and other stats.
vmstat -a
10. How to reduce or shrink the size of the LVM partition?
Below are the logical steps to reduce the size of the LVM partition:
- Unmount the file system using the unmount command
- Use the resize2fs command as follows:
resize2fs /dev/mapper/myvg-mylv - Then, use the lvreduce command as follows:
lvreduce -L 10G /dev/mapper/myvg-mylv
This way, we can reduce the size of the LVM partition and fix the size of the file system to 10 GB.