Top 50 Linux Administration interview questions 2018

Top 50 Linux Administration interview questions 2018

1.What is LILO?

LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start the Operating system. LILO can be configured to boot other operating systems as well. LILO is customizable, which means that if the default configuration is not correct, it can be changed. Config file for LILO is lilo.conf.

LILO is also a code snippet which loads PC BIOS into the main memory at the time of starting the computer system. It handles the following tasks :

1. Locating Linux kernel.

2. Identifying other supporting programs and loading them in the memory.

3. Starting Kernel.

The selection of various kernel images and boot routines is supported by LILO. For this reason, it is known as boot manager.

Master Linux, in this Linux certification training.

2.You wish to print a file ‘draft’ with 60 lines on a page. What command would you use?

The command used : pr -l60 draft

The default page length when using pr is 66 lines.

The -l option specifies a different length.

3.What is LD_LIBRARY_PATH?

LD_LIBRARY_PATH is an environment variable. It is used for debugging a new library or a non-standard library. It is also used to identify what directories need to be searched. Path to search for directories needs to given.

The variable can be set using setenv—LD_LIBRARY_PATH–$PATH.

It is used to search for the shared objects / dynamic libraries by the operating system for extendable functionality at runtime.

Prepare yourself for the Linux Certification with comprehensive Linux online training.

4.Name a service that you should disable (which acts both as Web and FTP Server) on a Linux Server.

The finger service should be disabled because a remote user can get important information about the system by using that command.

Learn all about Linux through this online training course.

5.What does Sar provide? Where are Sar logs stored?

Sar collects, reports, or saves system activity information, sar 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 forth) and limitation of problems in this manner. If CPU utilization is near 100 % (user + nice + system), the workload sampled is CPU-bound.

By default, log files of Sar command is located at /var/log/sa/sadd file, where dd parameter indicates the current day.

6.How to check Memory stats and CPU stats as a Linux admin?

Using ‘free’ & ‘vmstat’ command, we can display the physical and virtual memory statistics, respectively. With the help of ‘sar’ command, we can see the CPU utilization & other stats.

Go through the Linux video to get clear understanding of concepts.

7.How to reduce or shrink the size of LVM partition?

Below are the logical steps to reduce size of LVM partition :

Unmount the filesystem using unmount command,

Use resize2fs command , e.g resiz2fs /dev/mapper/myvg-mylv 10G

Now use the lvreduce command as lvreduce -L 10G /dev/mapper/myvg-mylv

The above Command will shrink the size LVM partition and fixes the filesystem size to 10GB.Most in-depth, industry-led curriculum in linux.

8.What are the different modes of Network bonding in Linux?

Below are list of modes used in Network Bonding :

balance-rr or 0 – round-robin mode for fault tolerance and load balancing.

active-backup or 1 – Sets active-backup mode for fault tolerance.

balance-xor or 2 – Sets an XOR (exclusive-or) mode for fault tolerance and load balancing.

broadcast or 3 – Sets a broadcast mode for fault tolerance. All transmissions are sent on all slave interfaces.

802.3ad or 4 – Sets an IEEE 802.3ad dynamic link aggregation mode. Creates aggregation groups that share the same speed & duplex settings.

balance-tlb or 5 – Sets a Transmit Load Balancing (TLB) mode for fault tolerance & load balancing.

balance-alb or 6 – Sets an Active Load Balancing (ALB) mode for fault tolerance & load balancing.

Now that you are aware of network bonding in Linux, Check Linux online training.

9.How to check and verify the status of the bond interface?

Using the command ‘cat /proc/net/bonding/bond0,’ we can check what mode is enabled and what LAN cards are used in this bond. In this example, we have one one bond interface. However, we can have multiple bond interfaces like bond1, bond2 and so on.

10. How can you enhance the security of password file?

Linux keep user account information in a text file called /etc/passwd. This file also stores one way encrypted password. It is accessed by several tools to get user information, which is a security risk, so file need to ‘Word Readable.’ To minimize the security risk, you can use shadow password format. This method saves account information in regular file /etc/passwd.

However, the password is stored as a single “x” character (not actually stored in this file). A second file, called “/etc/shadow” contains encrypted password as well as other information such as account or password expiration values, etc. The /etc/shadow file is readable only by the root account and is therefore less of a security risk

11.What command can you use to make a tape archive file of a /home directory and send it to the /dev/tape device?

The correct command is tar -cvf /dev/tape /home.

The -xvf option is used to extract files from an archive.Expert Linux Professionals are in much demand.

Take this linux administration online certification & join the big league.

12.Suppose your FTP Server is hacked and the entire server needs to be restored. How should you restore the original kernel system files?

You cannot restore the entire operating system from tape backup device. So you should reinstall the core operating system, and then restore system configuration files and user data from tape backup device.

13.Why should you avoid Telnet to administer a Linux system remotely?

Telnet uses most insecure method for communication. It sends data across the network in plain text format and anybody can easily find out the password using the network tool. In the case of Telnet, these include the passing of login credentials in plain text, which means anyone running a sniffer on your network can find the information he needs to take control of a device in a few seconds by eavesdropping on a Telnet login session.

13.What is Puppet Server?

Puppet is an open-source & enterprise software for configuration management toll in UNIX like operating system. Puppet is an IT automation software that is used to push configuration to its clients (puppet agents) using code. Puppet code can do multiple tasks from installing new software to checking file permissions to updating user accounts.

14.What is the difference between Cron and Anacron?

Minimum granularity with Cron is minute while it is in days with Anacron.

Cron job can be scheduled by any normal user while Anacron can be scheduled only by the super user (the superuser is a special user account used for system administration. Depending on the operating system (OS), the actual name of this account might be root,administrator, admin or supervisor)

Cron expects the system to be up and running while the Anacron doesn’t expect the system to be up and running all the time. In case of Anacron, if a job is scheduled and the system is down that time, it will execute the job as soon as the system is up and running.

Cron is ideal for servers while Anacron is ideal for desktops and laptops.

Cron should be used when you want a job to be executed at a particular hour and minute while Anacron should be used in when the job can be executed irrespective of the hour and minute.

15.What command is used to check the number of files, disk space and each user’s defined quota?

repquota command is used to check the status of the user’s quota along with the disk space and number of files used.

This command gives a summary of the user’s quota that how much space and files are left for the user. Each user has a defined quota in Linux. This is done mainly for the security as some users have only limited access to files. This provides a security to the files from unwanted access. The quota can be given to a single user or to a group of users.

16.What is the name and path of the main system log?

By default, the main system log is ‘/var/log/messages’. This file contains all the messages and the script written by the user. By default, all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, non-kernel boot issues, and messages that go to ‘dmesg’. dmesg is a system file that is written upon system boot.

19. Can Linux computer be made a router so that several machines may share a single Internet connection? How?

Yes, a Linux machine can be made a router. This is called “IP Masquerade.” IP Masquerade is a networking function in Linux similar to the one-to-many (1: Many) NAT (Network Address Translation) servers found in many commercial firewalls and network routers.

The IP Masquerade feature allows other “internal” computers connected to this Linux box (via PPP, Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows this functionality even if the internal computers do not have IP addresses.

The IP masquerading can be done by the following steps :

The Linux PC must have an internet connection and a connection to LAN. Typically, the Linux PC has two network interfaces-an Ethernet card for the LAN and a dial-up PPP connection to the Internet (through an ISP).

All other systems on your LAN use the Linux PC as the default gateway for TCP/IP networking. Use the same ISP-provided DNS addresses on all systems.

Enable IP forwarding in the kernel. By default the IP forwarding is not enabled. To ensure that IP forwarding is enabled when you reboot your system, place this command in the /etc/rc.d/rc.local file.

Run /sbin/iptables-the IP packet filter administration program-to set up the rules that enable the Linux PC to masquerade for your LAN.

20. How to change window manager by editing your home directory?

“/.xinitrc file” allows changing the window manager we want to use when logging into X from that account. The dot in the file name shows you that the file is a hidden file and doesn’t show when you do a normal directory listing. For setting a window manager we have to save a command in this file.

The syntax of command is : exec window manager. After this, save the file. Next time when you run a startx a new window manager will open and become default.

The commands for starting some popular window managers and desktop environments are :

KDE = startkde

Gnome = gnome-session.

Blackbox = blackbox.

FVWM = fvwm

Window Maker = wmaker.

IceWM = icewm

21. How shadow passwords are given by in Linux?

pwconv command is used for giving shadow passwords. Shadow passwords are given for better system security. The pwconv command creates the file /etc/shadow and changes all passwords to ‘x’ in the /etc/passwd file.

First, entries in the shadowed file which don’t exist in the main file are removed. Then, shadowed entries which don’t have `x’ as the password in the main file are updated. Any missing shadowed entries are added. Finally, passwords in the main file are replaced with `x’. These programs can be used for initial conversion as well to update the shadowed file if the main file is edited by hand.

22. What daemon is used for scheduling of the commands?

The crontab command is used for scheduling of the commands to run at a later time.

SYNTAX

crontab [ -u user ] file

crontab [ -u user ] { -l | -r | -e }

 

23. What shell does a Linux Administrator assign to a POP3 mail-only account?

POP3 mail only account is assigned to the /bin/false shell. However, assigning bash shell to a POP3 mail only gives user login access, which is avoided. /bin/nologin can also be used. This shell is provided to the user when we don’t want to give shell access to the user. The user cannot access the shell and it rejects shell login on the server as in Telnet. It is mainly for the security of the shells.

POP3 is basically used for downloading mail to mail program. So for illegal downloading of emails on the shell, this account is assigned to the /bin/false shell or /bin/nologin. These both shells are same as they both do the same work of rejecting the user login to the shell.

The main difference between these two shells is that false shell shows the incorrect code and any unusual coding when user login to it. But the nologin shell simply tells that no such account is available. So nologin shell is used often in Linux.

24.What is the name and path of the main system log?

By default, the main system log is ‘/var/log/messages’. This file contains all the messages and the script written by the user. By default all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, non-kernel boot issues, and messages that go to ‘dmesg’. dmesg is a system file that is written upon system boot.

25.How secured is Linux? Explain.

Security is the most important aspect of an operating system. Due to its unique authentication module, Linux is considered as more secured than other operating systems. Linux consists of PAM. PAM is Pluggable Authentication Modules. It provides a layer between applications and actual authentication mechanism. It is a library of loadable modules which are called by the application for authentication. It also allows the administrator to control when a user can log in. All PAM applications are configured in the directory “/etc/pam.d” or in a file “/etc/pam.conf”. PAM is controlled using the configuration file or the configuration directory.

26.Can Linux computer be made a router so that several machines may share a single Internet connection? How?

Yes a Linux machine can be made a router. This is called “IP Masquerade.” IP Masquerade is a networking function in Linux similar to the one-to-many (1: Many) NAT (Network Address Translation) servers found in many commercial firewalls and network routers. The IP Masquerade feature allows other “internal” computers connected to this Linux box (via PPP, Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows this functionality even if the internal computers do not have IP addresses.

The IP masquerading can be done by the following steps:

1. The Linux PC must have an internet connection and a connection to LAN. Typically, the Linux PC has two network interfaces-an Ethernet card for the LAN and a dial-up PPP connection to the Internet (through an ISP).

2. All other systems on your LAN use the Linux PC as the default gateway for TCP/IP networking. Use the same ISP-provided DNS addresses on all systems.

3. Enable IP forwarding in the kernel. By default the IP forwarding is not enabled. To ensure that IP forwarding is enabled when you reboot your system, place this command in the /etc/rc.d/rc.local file.

4. Run /sbin/iptables-the IP packet filter administration program-to set up the rules that enable the Linux PC to masquerade for your LAN.

27.What is the minimum number of partitions that you need to install Linux?

Minimum 2 partitions are needed for installing Linux. The one is “/ or root” which contains all the files and the other is swap. Linux file system is function specific which means that files and folders are organized according to their functionality. For example, all executables are in one folder, all devices in another, all libraries in another and so on. “/ or root” is the base of this file system. All the other folders are under this one. “/” can be consider as “C:”. Swap is a partition that will be used as virtual memory. If there is no more available RAM a Linux computer will use an area of the hard disk, called swap, to temporarily store data. In other words it is a way of expanding your computers RAM.

28.Which command is used to review boot messages?

dmesg command is used to review boot messages. This command will display system messages contained in the kernel ring buffer. We can use this command immediately after booting to see boot messages. A ring buffer is a buffer of fixed size for which any new data added to it overwrites the oldest data in it.

Its basic syntax is:

dmesg [options]

Invoking dmesg without any of its options causes it to write all the kernel messages to standard output. This usually produces far too many lines to fit into the display screen all at once and thus only the final messages are visible. However, the output can be redirected to the less command through the use of a pipe, thereby allowing the startup messages to be viewed on one screen at a time

dmesg | less

29.Which utility is used to make automate rotation of a log?

logrotate command is used to make automate rotation of log.

Syntax of the command is:

logrotate [-dv] [-f|] [-s|] config_file+

It allows automatic rotation, compression, removal, and mailing of log files. This command is mainly used for rotating and compressing log files. This job is done every day when a log file becomes too large. This command can also be run by giving on command line. We can done force rotation by giving –f option with this command in command line. This command is also used for mailing. We can give –m option for mailing with this command. This option takes two arguments one is subject and other is recipient name.

30.What are the partitions created on the mail server hard drive?

The main partitions are done firstly which are root, swap and boot partition.

But for the mail server three different partitions are also done which are as follows:

1. /var/spool – This is done so that if something goes wrong with the mail server or spool than the output cannot overrun the file system.

2. /tmp – Putting this on its own partition prevents any user item or software from overrunning the system files.

3. /home – Putting this on its own is useful for system upgrades or reinstalls. It allow not to wipe off the /home hierarchy along with other areas.

31.If a volume group named VG0 already exists and we need to extend this volume group up to 4GB. How will you do it?

Firstly create Physical volume (/dev/sda7) of size 4GB.

Now run following command.

vgextend VG0 /dev/sda7

32. Is there any relation between modprobe.conf file and network devices?

Yes, this file assigns a kernel module to each network device.

For Example :-

[[email protected] ~]# cat /etc/modprobe.conf

alias eth0 b44

Here, b44 is the kernel module for network device eth0.

We can confirm whether this module “b44” is present or not by the following command

[[email protected] ~]# lsmod |grep b44

b44 29005 0

33.What is YUM?

YUM stands for Yellow dog Updater, Modified because it is based on YUP, the Yellow dog Updater. Where does the name Yellow dog come from? Yellow Dog is a version of Linux for the Power Architecture hardware and is RPM-based, just like Red Hat Enterprise Linux and Fedora. YUP, and later YUM, were written by the Linux community as a way to maintain an RPM-based system

 

34. What is the difference between ext2 and ext3 file systems?

The ext3 file system is an enhanced version of the ext2 file system.

The most important difference between Ext2 and Ext3 is that Ext3 supports journaling.

After an unexpected power failure or system crash (also called an unclean system shutdown), each mounted ext2 file system on the machine must be checked for consistency by the e2fsck program. This is a time-consuming process and during this time, any data on the volumes is unreachable.

The journaling provided by the ext3 file system means that this sort of file system check is no longer necessary after an unclean system shutdown. The only time a consistency check occurs using ext3 is in certain rare hardware failure cases, such as hard drive failures. The time to recover an ext3 file system after an unclean system shutdown does not depend on the size of the file system or the number of files. Rather, it depends on the size of the journal used to maintain consistency. The default journal size takes almost a second to recover, depending on the speed of the hardware.

35. Explain /proc filesystem?

/proc is a virtual file system that provides detailed information about Linux kernel, hardware and running processes. Files under /proc directory named as Virtual files.

Since /proc contains virtual files, it is called virtual file system. These virtual files have unique qualities. Most of them are listed as zero bytes in size.

Virtual files such as /proc/interrupts, /proc/meminfo, /proc/mounts, and /proc/partitions provide an up-to-the-moment glimpse of the system’s hardware. Others: /proc/filesystems file and the /proc/sys/ directory provide system configuration information and interfaces.

 

37.What is the difference between UNIX and LINUX?

Unix originally began as a propriety operating system from Bell Laboratories, which later on spawned into different commercial versions. On the other hand, Linux is free, open source and intended as a non-propriety operating system for the masses.

38.What is BASH?

BASH is short for Bourne Again SHell. It was written by Steve Bourne as a replacement to the original Bourne Shell (represented by /bin/sh). It 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.

39. What is Linux Kernel?

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.

40.What is LILO?

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

41.What is a swap space?

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.

42.What is the advantage of open source?

Open source allows you to distribute your software, including source codes freely to anyone who is interested. People would then be able to add features and even debug and correct errors that are in the source code. They can even make it run better and then redistribute these enhanced source code freely again. This eventually benefits everyone in the community.

43.What are the basic components of Linux?

Just like any other typical operating system, Linux has all of these components: kernel, shells and GUIs, system utilities, and an application program. What makes Linux advantageous over other operating system is that every aspect comes with additional features and all codes for these are downloadable for free.

44. Does it help for a Linux system to have multiple desktop environments installed?

In general, one desktop environment, like KDE or Gnome, is good enough to operate without issues. It’s all a matter of preference for the user, although the system allows switching from one environment to another. Some programs will work in one environment and not work on the other, so it could also be considered a factor in selecting which environment to use.

45.What is the basic difference between BASH and DOS?

The key differences between the BASH and DOS console lie in 3 areas:

– BASH commands are case sensitive while DOS commands are not;

– Under BASH, / character is a directory separator and \ acts as an escape character. Under DOS, / serves as a command argument delimiter and \ is the directory separator

– DOS follows a convention in naming files, which is 8 character file name followed by a dot and 3 characters for the extension. BASH follows no such convention.

46.What is the importance of the GNU project?

This so-called Free software movement allows several advantages, such as the freedom to run programs for any purpose and freedom to study and modify a program to your needs. It also allows you to redistribute copies of software to other people, as well as the freedom to improve software and have it released for the public.

47.Describe the root account.

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.

48.What is CLI?

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.

49.What is GUI?

GUI, or Graphical User Interface, make 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 system, as well as adding more attraction through images, icons, and colors.

50.How do you open a command prompt when issuing a command?

To open the default shell (which is where the command prompt can be found), press Ctrl-Alt-F1. This will provide a command line interface (CLI) from which you can run commands as needed.

51.What is the role of Kudzu?

Kudzu is used to detect new Hardware. RedHat Linux runs a hardware discoverer, named kudzu. When attempting to identify a serial port Kudzu resets the serial port. This stops the serial console. Kudzu is configured from the file/etc/sysconfig/kudzu.

52.How do you create ext4 file system?

# mke2fs -t ext4 /dev/DEV

36. How to Enable ACLs for /home partition?

Add following entry in /etc/fstab

LABEL=/home /home ext3 acl 1 2

Now remount /home partition with acl option.

mount -t ext3 -o acl /dev/sda3 /home

top
ETLHIVE is a Trademark of Itelligence Infotech Pvt Ltd.   *PMP®, PMBOK, PMI, PgMP, CAPM, PMI-RMP, and PMI-ACP are registered trademarks of the Project Management Institute, Inc. *ITIL®, IT Infrastructure Library, Swirl Logo, Prince2 are registered trademarks of AXELOS Limited.
25th May 2019 – Demo Sessions – Pimple Saudagar – Saleforce : 12pm/22th may: 7pm | Python : 3pm | Digital Marketing : 11am | Selenium : 4pm | AWS : 6pm | Devops : 11am | Informatica : 11am |Data Science : 4pm| Hadoop : 10am Nal Stop – AWS : 12pm | Python : 2pm | Kharadi – Data Science : 12pm |