Linux Admin Flashcards
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.
Compare Linux with Windows
Linux
Type of OS - Open-source
High level of customization
High level of security
Windows
Proprietary OS
Customization - cannot be changed
Vulnerable to security issues
What are the components of the Linux system?
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.
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. lilo.conf is the configuration file for LILO. 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.
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.
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.
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.
To disable this service use command: sudo systemctl disable vsftpd
What does sar provide? Where are the sar logs stored?
The sar command in Linux is a valuable tool for collecting and analyzing system activity information. It reports various aspects of system performance, such as CPU usage, memory utilization, disk activity, network traffic, and more. When troubleshooting performance issues, sar enables you to review historical data and identify the causes of high load on specific system components.
When the CPU utilization is close to 100 percent, it indicates that the processing workload primarily demands the CPU. This information helps determine if the system is experiencing a CPU-bound situation.
By default, sar saves its log files in the /var/log/sa/sadd directory, where “dd” represents the current day. These log files are valuable for retrospective analysis and tracking system activity over time.
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.
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 10G
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.
What are the different modes of Network Bonding in Linux?
Below is the list of various modes used in Network Bonding:
balance-rr or mode 0: The round-robin mode for fault tolerance and load balancing
active-backup or mode 1: Sets the active-backup mode for fault tolerance
balance-xor or mode 2: Sets an XOR (exclusive-or) mode for fault tolerance and load balancing
broadcast or mode 3: Sets a broadcast mode for fault tolerance. All transmissions are sent on all the slave interfaces
802.3ad or mode 4: Sets an IEEE 802.3ad dynamic link aggregation mode and creates aggregation groups that share the same speed and duplex settings
balance-tlb or mode 5: Sets a transmit load balancing (TLB) mode for fault tolerance and load balancing
balance-alb or mode 6: Sets an active load balancing (ALB) mode for fault tolerance and load balancing
How to check and verify the status of the bond interface?
Using the following command, we can check which mode is enabled and what LAN cards are used in this bond:
cat /proc/net/bonding/bond0
In this example, we have a single bond interface. However, we can have multiple bond interfaces like bond1, bond2, and so on.
Do you know the Maximum length (in bytes) of the filename in Linux
The maximum length of a filename is 255 bytes. In this filename, the pathname is not included, so the total length of the pathname and filename may easily surpass 255 characters.
What are the two different kinds of Linux User Modes?
The following are the two types of Linux user modes:
Command Line
GUI
What is Hard Link?
In Linux, Hard links can be defined as another name for an already existing file. For each file, we can generate an unlimited number of hard links. They have the ability to generate links for other hard connections. We can use the Is-I
command to find out the total number of hard links in a file. And we can create Hard links using the following command:
$ ln [original filename] [link name]