Top 46 Linux Interview Questions And Answers Pdf

1. Explain virtual desktop ? (Linux Interview Questions)_text]Answer:
When there are multiple windows available on the current desktop and there appears the problem of minimizing and maximizing windows or restoring all the current programs, there ‘Virtual Desktop’ serves as an alternative. It allows you to open one or more programs on a clean slate. Virtual desktops are basically stored on a remote server and serve the following benefits:

Virtual desktops are basically stored on a remote server and serve the following benefits

Cost savings as the resources can be shared and allocated as and when required.
Resources and energy are more efficiently used.
Data integrity is improved.
Centralized administration
Less compatibility issues.

Linux Interview Questions2. Explain /proc file system ?_text]Answer:
/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.3. What is LILO ?_text]Answer:
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.4. What is the difference between soft and hard mounting points ?_text]Answer:
In the soft mount, if the client fails to connect the server, it gives an error report and closes the connection whereas in hard mount, if the client fails to access the server, the connection hangs; and once the system is up, it again accesses the server.5. How can you enhance the security of password file ?_text]Answer:
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.6. What is Puppet Server ?_text]Answer:
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.7. What is the difference between Cron and Anacron ?_text]Answer:
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.8. What daemon is used for scheduling of the commands ?_text]Answer:
The crontab command is used for scheduling of the commands to run at a later time.

crontab [ -u user ] file
crontab [ -u user ] { -l | -r | -e }
l List – display the current crontab entries.
r Remove the current crontab.
e Edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables.
When user exits from the editor, the modified crontab will be installed automatically. Each user can have their own crontab, and though these are files in /var, they are not intended to be edited directly.
If the –u option is given than the crontab gives the name of the user whose crontab is to be tweaked. If it is given without this then it will display the crontab of the user who is executing the command.

Linux Interview Questions9. What shell does a Linux Administrator assign to a POP3 mail-only account ?_text]Answer:
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.10. What are the different modes when using the vi editor ?_text]Answer:
The 3 different kinds of modes in vi editor are enlisted below

Command Mode/ Regular Mode
Insertion Mode/ Edit Mode
Ex Mode/ Replacement Mode11. What is env command in Linux ?_text]Answer:
env command allows users to set or print the environment variables. During troubleshooting, users can find it useful for checking if the wrong environment variable prevents your application from starting.

env Command Example:

$ env

New 54 Linux Admin Interview Questions And Answers Pdf12. What is top Command in Linux ?_text]Answer:
top command displays and updates sorted process information. Use this top command to determine which processes are running and how much memory and CPU they are consuming.13. What command is used to check the number of files, disk space and each user’s defined quota ?_text]Answer:
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.14. How shadow passwords are given by in Linux ?_text]Answer:
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.15. If a volume group named VG0 already exists and we need to extend this volume group up to 4GB. How will you do it ?_text]Answer:
Firstly create Physical volume (/dev/sda7) of size 4GB.
Now run following command.
vgextend VG0 /dev/sda716. What is Linux Kernel ?_text]Answer:
Linux Kernel is low level system software. It is used to manage the hardware resources for the users. It provides an interface for user-level interaction.

Linux Interview Questions17. What is Swap space ?_text]Answer:
Swap space is the amount of physical memory that is allocated for use by Linux to hold some concurrent running programs temporarily. This condition usually occurs when Ram does not have enough memory to support all concurrent running programs. This memory management involves the swapping of memory to and from physical storage.

There are different commands and tools available to manage the Swap space usage.18. Linux is which kind of Operating System ?_text]Answer:
Multi User
Multi Tasking
Multi Process
All of the above
None of the above
Answer : All of the Above. Linux is an Operating System which supports Multi User, Running a Number of Processes performing different tasks simultaneously.19. What do you understand by Root account ?_text]Answer:
As the name suggests, it is like a system administrator account which gives you the ability to fully control the system. Root account serves as the default account whenever Linux is installed.Below mentioned functions can be performed by Root account

Below mentioned functions can be performed by Root account

Create user accounts
Maintain user accounts
Assign different permissions to each account created and so on.20. Does the Alt+Ctrl+Del key combination work in Linux ?_text]Answer:
Yes, it works like windows.21. Which command would you use if you want to remove the password assigned to a group ?_text]Answer:
The gpasswd – r removes the password assigned to a group.22. What is the difference between BASH and DOS ?_text]Answer:
There are three key differences between BASH and DOS:

BASH commands are case sensitive while DOS commands are not
BASH follows no convention in naming files, while DOS follows a convention
Under BASH, / character serves as a directory separator while in DOS \ serves as the directory separa23. What is the difference between Linux and UNIX ?_text]Answer:
UNIX – Only big companies are allowed to use the UNIX copyright and name. IBM AIX, Sun Solaris, and HP-UX all are UNIX operating systems. Most UNIX operating systems are commercial in nature.

Linux is a Unix clone. But if you consider Portable Operating System Interface (POSIX) standards then Linux can be considered as UNIX.

Linux Is Just Kernal

All Linux distributions include GUI system, GNU utilities, installation & management tools, GNU c/c++ Compilers, Editors (vi), and various applications like OpenOffice, Firefox.

UNIX operating systems are considered as a complete OS as everything come from a single vendor.

License and cost

Linux is Free. You can download it from the Internet or redistribute it under GNU licenses. Most UNIX like operating systems are not free.

Security And Firewall

Linux comes with open source Netfilter and IPTables based firewall tool to protect your server and desktop from the crackers and hackers. UNIX operating systems comes with its own firewall products.

Backup And Recovery

UNIX and Linux come with their own set of tools for backing up data to tape and other backup media. However, both Linux and UNIX share some common tools such as tar, dump/restore, and cpio etc.24. What is du command in Linux ?_text]Answer:
du command in Linux is used to retrieve more detailed information about which files use the disk space in a directory.

du Command Example:

$ du -sh /var/log/*
1.8M /var/log/anaconda
384K /var/log/audit
4.0K /var/log/boot.log
0 /var/log/chrony
4.0K /var/log/cron
4.0K /var/log/maillog
64K /var/log/messages

firewall tool to protect your server and desktop from the crackers and hackers. UNIX operating systems comes with its own firewall products.

Backup And Recovery

UNIX and Linux come with their own set of tools for backing up data to tape and other backup media. However, both Linux and UNIX share some common tools such as tar, dump/restore, and cpio etc.

Linux Interview Questions25. What is iptables command in Linux ?_text]Answer:
iptables command blocks or allows traffic on a Linux host, similar to a network firewall. This iptables command may prevent certain applications from receiving or transmitting requests.

Learn how to use Linux, from beginner basics to advanced techniquesLearn Linux!26. What does cd – command do ?_text]Answer:
cd- command go to the previous director27. How to change window manager by editing your home directory ?_text]Answer:
“/.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 = icewm28. What is df -i command ?_text]Answer:
df -i command shows free inodes on mounted filesystems.29. What is a Shell script ?_text]Answer:
As the name suggests, the shell script is the script written for the shell. This is a program file or says a flat text file where certain Linux commands are executed one after another. Although the execution speed is slow, Shell script is easy to debug and can also simplify everyday automation processes.30. What is the name and path of the main system log ?_text]Answer:
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.31. What are System Startup Scripts ?_text]Answer:
By default, Linux and UNIX come with system initialization script but they are located in different directories:

HP-UX – /sbin/init.d
AIX – /etc/rc.d/init.d
Linux – /etc/init.d32. What are the some UNIX Operating System Names ?_text]Answer:
By default, Linux and UNIX come with system initialization script but they are located in different directories:

HP-UX – /sbin/init.d
AIX – /etc/rc.d/init.d
Linux – /etc/init.d33. Differentiate between BASH and DOS ?_text]Answer:
The basic differences between BASH and DOS can be understood from the below table

Show entriesSearch:
BASH commands are case sensitive. DOS commands are not case sensitive.
‘/’ character used as a directory separator.
‘\’ character acts as an escape character. ‘/’ character: serves as a command argument delimiter.
‘\’ character: serves as a directory separator.
File naming convention includes: 8 character file name followed by a dot and 3 characters for the extension. No file naming convention is followed in DOS.34. Explain the term GUI ?_text]Answer:
GUI stands for the Graphical user interface. GUI is considered as the most attractive and user-friendly because it consists of the usage of images and icons. These images and icons are clicked and being manipulated by the users for the purpose of communication with the system.

Advantages of GUI:

Allows users to navigate and operate the software with the help of visual elements.
More intuitive and rich interface is possible to be created.
Less chances of occurrence of errors as complex, multi-step, dependent tasks are easily grouped together.
Productivity is enhanced with the means of multitasking as with a simple click of the mouse, the user is able to maintain multiple open applications and transitions between them.
Disadvantages of GUI:

End-users have less control over the operating system and file systems.
Although it is easier to use mouse and keyboard for navigation and controlling operating system, the whole process is a bit slow.
It requires more resources because of the elements that need to be loaded such as icons, fonts, etc.35. What is the maximum length for any file name under LINUX ?_text]Answer:
The maximum length for any filename under Linux is 255 characters.36. How permissions are granted under LINUX ?_text]Answer:
A system administrator or the owner of the file can grant permissions using the ‘chmod’ command. Following symbols are used while writing permissions

‘+’ for adding permission
‘-‘ for denying permission
Permissions also includes single letter which denotes

u : user; g: group; o: other; a: all; r: read; w: write; x: execute.37. What is netstat command in Linux ?_text]Answer:
netstat command in Linux shows the network status. This netstat command shows network ports in use and their incoming connections.38. Explain the Linux Directory commands along with the description ?_text]Answer:
Enlisted below are the directory commands along with descriptions

pwd: It is a built-in command which stands for ‘print working directory’. It displays the current working location, working path starting with / and directory of the user. Basically, it displays the full path to the directory you are currently in.
Is: This command list out all the files in the directed folder.
cd: This stands for ‘change directory’. This command is used to change to the directory you want to work from the present directory. We just need to type cd followed by the directory name to access that particular directory.
mkdir: This command is used to create an entirely new directory.
rmdir: This command is used to remove a directory from the system.39. What is a root account ?_text]Answer:
The root account is like a system administrator account. It provides you full control of the system. You can create and maintain user accounts, assign different permission for each account etc.

Linux Interview Questions40. Explain the 3 kinds of file permissions under LINUX ?_text]Answer:
Every file and directory in Linux are assigned three types of owners namely ‘User’, ‘Group’, and ‘Others’. Find the three kinds of permissions defined for all the three owners

Read: This permission allows you to open and read the file as well as list the contents of the directory.
Write: This permission allows you to modify the contents of the file as well as allows adding, removing and renaming files stored in the directories.
Execute: User can access and run the file in the directory. You cannot run a file unless the execute permission is set.41. How do you create a new user without logging on as a root user ?_text]Answer:
Using the su command42. Differentiate between Cron and Anacron ?_text]Answer:
Difference between Cron and Anacron can be understood from the below table

Cron Anacron
Cron allows the user to schedule tasks to be executed every minute. Anacron allows the user to schedule tasks to be run either on a specific date or the first available cycle after the date.
Tasks can be scheduled by any normal user and are basically used when tasks have to be completed/executed at a particular hour or minute. Anacron can be used only by super users and is used when a task has to be executed irrespective of hour or minute.
It is ideal for servers It is ideal for desktops and laptops
Cron expects the system to be running 24×7. Anacron does not expects the system to be running 24×7.43. How to Enable ACLs for /home partition ?_text]Answer:
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 /home44. What do you understand by Linux Kernal? Is it legal to edit it ?_text]Answer:
‘Kernal’ basically refers to that core component of the computer operating system that provides basic services for the other parts as well as interacts with user commands. When it comes to ‘Linux Kernal’, it is referred as low-level system software providing an interface for user-level interactions.

Linux Kernal is considered as free and open source software which is capable of managing hardware resources for the users. As it is released under General Public Licence (GPL), it becomes legal for anyone to edit it.45. Differentiate between LINUX and UNIX ?_text]Answer:
Although there are multiple differences between LINUX and UNIX, enlisted below table covers all the major differences.

LINUX is an open source software development and free operating system used for computer hardware & software, game development, PCs, etc. UNIX is an operating system which is basically used in Intel, HP, internet servers, etc.
LINUX has priced as well as freely distributed and downloaded versions. Different versions/flavours of UNIX have different price structures.
Users of this operating system could be anyone including home users, developers, etc. This operating system was basically developed for mainframes, servers and workstations except for OSX which is designed such that it can be used by anyone.
File support system includes Ext2, Ext3, Ext4, Jfs, Xfs, Btrfs, FAT, etc. File support system includes jfs, gpfs, hfs, etc.
BASH (Bourne Again Shell) is the Linux default shell i.e. text mode interface which supports multiple command interpreters. Bourne shell serves as the text mode interface which is now compatible with many others including BASH.
LINUX provides two GUIs, KDE and Gnome. Common desktop environment was created which serves as a GUI for UNIX.
Examples: Red Hat, Fedora, Ubuntu, Debian, etc. Examples: Solaris, All Linux
It provides higher security and has about 60-100 viruses listed till date. It is also highly secured and has about 85-120 viruses listed till date.46. What are the different modes of Network bonding in Linux ?_text]Answer:
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.