Linux Admin Interview Questions And Answers Pdf

Linux Admin Interview Questions And Answers Pdf

1. How to check Memory stats and CPU stats as a Linux admin?
Answer: 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 a clear understanding of concepts.

2. What is tail command in Linux?
Answer: tail command displays the last part of a file. Generally, users don’t need every logline to troubleshoot. Instead, you want to check what your logs say about the most recent request to your application.

tail Example:

$ tail -n 100 /var/log/https/access_log
20) What is the maximum length for a file name in Linux?
255 characters.

3. What is the alternative method to a GUI installation in Linux?
Answer: Linux provides textbase installation as the alternative method of GUI installation.

4. Enlist some Linux distributors (Distros) along with its usage?
Answer: Different parts of LINUX say kernel, system environment, graphical programs, etc are developed by different organizations. LINUX Distributions (Distros) assemble all these different parts of Linux and give us a compiled operating system to be installed and used.

There are around six hundred Linux distributors. Let us see some of the important ones

  • UBuntu: It is a well known Linux Distribution with a lot of pre-installed apps and easy to use repositories libraries. It is very easy to use and works like a MAC operating system.
  • Linux Mint: It uses cinnamon and mates desktop. It works on Windows and should be used by newcomers.
  • Debian: It is the most stable, quicker and user-friendly Linux Distributors.
  • Fedora: It is less stable but provides the latest version of the software. It has a GNOME3 desktop environment by default.
  • Red Hat Enterprise: It is to be used commercially and to be well tested before release. It usually provides a stable platform for a long time.
  • Arch Linux: Every package is to be installed by you and is not suitable for the beginners.

5. How do you combine two lines from two sorted files in Linux?
Answer: Use this command: comm file1 file2.

6. What is the core of the Linux Operating System?
Answer: The kernel is the core of the Linux Operating System. Shell is a Command Line Interpreter, Command is user Instruction to Computer, Script is a collection of commands stored in a file and Terminal is a command Line Interface.

7. What is the basic difference between UNIX and Linux Operating System?
Answer: Linux Operating System is Free and Open Source Software, the kernel of which is created by Linus Torvalds and community. Well, you can not say UNIX Operating System doesn’t come under the category of Free and Open Source Software, BSD is a variant of UNIX which comes under the category of FOSS. Moreover Big companies like Apple, IBM, Oracle, HP, etc. are contributing to UNIX Kernel.

1. Let’s say you maintain a backup on a regular basis for the company you are working. The backups are maintained in Compressed file format. You need to examine a log, two months old.

8. How will you restrict IP so that the restricted IP’s may not use the FTP Server?
Answer: We can block suspicious IP by integrating tcp_wrapper. We need to enable the parameter “tcp_wrapper=YES” in the configuration file at ‘/etc/vsftpd.conf’. And then add the suspicious IP in the ‘host.deny’ file at location ‘/etc/host.deny’. 

9. Tell us the difference between Telnet and SSH?
Answer: Telnet and SSH both are communication protocol which is used to manage the remote system. SSH is Secured, which requires exchanging of the key opposite of telnet which transmits data in plain text, which means telnet is less secure than SSH.

10. You want to search for all the *.tar files in your Home directory and wants to delete all at once. How will you do it?

Answer: We need to use find command with rm command to delete all “.tar” files. 

11. What are the modes used in VI editor?
Answer:

There are 3 types of modes in vi Editor:

  • Regular mode or command mode
  • Insertion mode or edit mode
  • Replacement mode or Ex mode

12. What does Sar provide? Where are Sar logs stored?
Answer: 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.

13. Explain Redirection?
Answer: It is well known that every command takes input and displays output. Keyboard serves as the standard input device and screen serves as the standard output device. Redirection is defined as the process of directing data from one output to another or even cases exist where output serves as input data for another process.

There are basically three streams available in which input and output of the Linux environment are distributed.

These are explained as below

Input Redirection: ‘<’ symbol is used for input redirection and is numbered as (0). Thus it is denoted as STDIN(0). Output Redirection: ‘>’ symbol is used for output redirection and is numbered as (1). Thus it is denoted as STDOUT(1).
Error Redirection: It is denoted as STDERR(2).

14. Why is Linux considered more secure than other operating systems?
Answer: Linux is an open-source operating system and nowadays it is growing rapidly in the tech world/market. Although the entire code written in Linux can be read by anyone, then to it is considered as more secure because of the following reasons

  • Linux provides its user with limited default privileges which are basically restricted to the lower levels .i.e. in the case of any virus attack, it
  • will reach only local files and folders where the system-wide damage is saved.
  • It has a powerful auditing system which includes detailed logs.
  • Enhanced features of IPtables are used in order to implement a greater level of security for Linux machine.
  • Linux has tougher program permissions before installing anything on your machine. 

15. Enlist some Linux networking and troubleshooting commands?
Answer: Every computer is connected to network internally or externally for the purpose of exchanging information. Network troubleshooting and configuration are essential parts of and network administration. The networking commands enable you to quickly troubleshoot connection issues with another system, check the response of another host, etc.

A network administrator maintains a system network which includes network configuration and troubleshooting. Mentioned below are few commands along with their description:

Mentioned below are few commands along with their description

  • Hostname: To view the hostname (domain and IP address) of the machine and to set the hostname.
  • Ping: To check if the remote server is reachable or not.
  • ifconfig: To display and manipulate route and network interfaces. It displays network configuration. ‘IP’ is the replacement of the ifconfig command.
  • netstat: It displays network connections, routing tables, interface statistics. ‘ss’ is the replacement of netstat command which is used to get more information.
  • Traceroute: It is a network troubleshooting utility which is used to find the number of hops required for a particular packet to reach the destination.
  • tracepath: It is same as traceroute with a difference that it does not require root privileges.
  • Dig: This command is used to query the DNS name servers for any task related to DNS lookup.
  • nslookup: To find DNS related query.
  • Route: It shows the details of the routing table and manipulates the IP routing table.
  • tr: This command combines ping and track path into a single command.
  • Ifplugstatus: This command tells us whether the network cable is plugged in or not.

16. What is df -h command?
Answer: This command show free space on mounted file systems.

17. What is the difference between UNIX and Linux?
Answer: UNIX was originally started as a propriety operating system for Bell laboratories, which later release their commercial version while Linux is a free, open-source and a nonproprietary operating system for the mass uses.

18. What is the difference between locating and locate command?
Answer: The slocate looks for the files that user have access whereas locate will search for the file with the updated result.

19. Linux initially was developed for intel X86 architecture but has been ported to another hardware platform than any other Operating System. Do you agree?
Answer: Yes, I do agree. Linux was written for x86 machine and has been ported to all kind of platform. Today’s more than 90% of supercomputers are using Linux. Linux made a very promising future in mobile phone, Tablets. In-fact we are surrounded by Linux in remote controls, space science, Research, Web, Desktop Computing. The list is endless.

20. Explain Linux Shell?
Answer: For executing any commands user uses a program known as the shell. Linux shell is basically a user interface used for executing the commands and communicating with Linux operating system. Shell does not use the kernel to execute certain programs, create files, etc. There are several shells available with Linux which includes the following

BASH (Bourne Again SHell)
CSH ( C Shell)
KSH ( Korn Shell)
TCSH
There are basically two types of Shell commands

  • Built-in shell commands: These commands are called from the shell and executed directly within the shell. Examples: ‘pwd’, ’help’, ’type’, ’set’, etc.
  • External/ Linux commands: These commands are totally shell independent, have their own binary and are located in the file system.

21. Explain command grouping in Linux?
Answer: Command grouping is basically done by the use of braces ‘()’ and parenthesis ‘{}’. Redirection is applied to the entire group when the command is grouped.

  • When commands are placed within the braces, then they are executed by the current shell. Eg: (list)
  • When the commands are placed within the parenthesis, then they are executed by a subshell. Eg: {list;}

22. How to create a new file and modify an existing file in vi editors?
Answer: Find below the commands with the description

vi filename: This is the command used to create a new file as well as modify an existing file.
View filename: This command opens an existing file in read-only mode.
X: This command deletes the character which is under the cursor or before the cursor location.
dd: This command is used to delete the current line.

23. Is it legal to edit Linux Kernel?
Answer: Yes. You can edit Linux Kernel because it is released under General Public License (GPL) and anyone can edit it. It comes under the category of free and open source software.

24. Enlist the basic components of LINUX?
Answer: Linux operating system basically consists of 3 components which are enlisted below

  • Kernel: This is considered as the core part and is responsible for all major activities of the Linux operating system. Linux Kernel is considered as free and open source software which is capable of managing hardware resources for the users. It consists of various modules and interacts directly with the underlying hardware.
  • System Library: Most of the functionalities of the operating system are implemented by System Libraries. These act as a special function using which application programs accesses Kernel’s features.
  • System Utility: These programs are responsible for performing specialized, individual-level tasks.

25. Why we use LINUX?
Answer: LINUX is used widely because it is completely different from other operating systems where every aspect comes with something extra i.e. some additional features. Some of the major reasons to use LINUX are listed below

  • It is an open source operating system where programmers get the advantage of designing their own custom OS
  • Software and the server licensing required to install Linux is completely free and can be installed on many computers as required
  • It has low or minimum but controllable issues with viruses, malware, etc
  • It is highly secured and supports multiple file systems.

26. Enlist the features of the Linux operating system?
Answer: Following are some important features of the LINUX operating system

  • Linux kernel and application programs can be installed on any kind of hardware platform and thus is considered portable.
  • It serves the purpose of multitasking by serving various functions simultaneously.
  • It provides the security services in three ways namely, Authentication, Authorization, and Encryption.
  • It supports multiple users to access the same system resource but by using different terminals for operation.
  • Linux provides a hierarchical file system and its code is freely available to all.
  • It has its own application support (to download and install applications) and customized keyboards.
  • Linux distros provide live CD/USB to their users for installation.

27. What is the advantage of open source?
Answer: Open source facilitates you to distribute your software, including source codes freely to anyone who is interested. So, you can add features and even debug and correct errors of the source code.

28. What is cat command in Linux?
Answer: In Linux cat command concatenates and prints files. Users might issue cat to check the contents of your dependencies file or to confirm the version of the application that you have already built locally.

29. Which command would you use to create a file system on a new hard drive?
Answer: The mkfs command

30. Which popular office suite is available free for both Microsoft and Linux?
Answer: Open Office Suite is available free for both Microsoft and Linux. You can install it on both of them.

31. Suppose your company is recently switched from Microsoft to Linux and you have some MS Word document to save and work in Linux, what will you do?
Answer: Open Office Suite is available free for both Microsoft and Linux. You can install it on both of them.

32. What is SMTP?
Answer: SMTP stands for Simple Mail Transfer Protocol. It is an internet standard for mail transmission.

33. Why do developers use MD5 options on passwords?
Answer: MD5 is an encryption method so it is used to encrypt the passwords before saving.

34. What is a virtual desktop?
Answer: The virtual desktop is used as an alternative to minimizing and maximizing different windows on the current desktop. Virtual desktop facilitates you to open one or more programs on a clean slate rather than minimizing or restoring all the needed programs.

35. What is Samba? Why is it used?
Answer: Samba service is used to connect Linux machines to Microsoft network resources by providing Microsoft SMB support.

36. Explain the term CLI?
Answer: CLI stands for Command Line Interface. It is a way for humans to interact with computers and is also known as the Command line user interface. It relies on textual request and response transaction process where user types declarative commands to instruct the computer to perform operations.

Advantages of CLI

  • Very flexible
  • Can easily access commands
  • Much faster and easier to use by expert
  • Does not use much CPU processing time.

Disadvantages of CLI

  • Learning and remembering type commands is hard.
  • Have to be typed precisely.
  • Can be very confusing.
  • Surfing web, graphics, etc are a few tasks which are hard or impossible to do on the command line.

37. You want to send a message to all connected users as “Server is going down for maintenance”, what will you do?
Answer: CLI stands for Command Line Interface. It is a way for humans to interact with computers and is also known as the Command line user interface. It relies on textual request and response transaction process where user types declarative commands to instruct the computer to perform operations.

Advantages of CLI

  • Very flexible
  • Can easily access commands
  • Much faster and easier to use by expert
  • Does not use much CPU processing time.
  • Disadvantages of CLI

Learning and remembering type commands is hard.

  • Have to be typed precisely.
  • Can be very confusing.
  • Surfing web, graphics, etc are a few tasks which are hard or impossible to do on the command line.

38. What does curl command do in Linux?
Answer: In Linux, curl command is used to test an application’s endpoint or connectivity to an upstream service endpoint. curl command will be used to determine if the application can reach another service, like a database, or checking if your service is healthy.

curl Example:

$ curl -I -s myapplication:5000
HTTP/1.0 500 INTERNAL SERVER ERROR

This example through an exception saying that your application can’t reach your server.

In the above command, the -I option shows the header information and the -s option silences the response body.

39. What is the difference between ext2 and ext3 file systems?
Answer: 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.

40. Which daemon controls the print spooling process?
Answer:

The line printing daemon

Linux Admin Interview Questions

41. What is Linux pwd (print working directory) command?
Answer: Linux pwd command displays the whole path of the current location you are working in starting from the root ‘/’. For example, to print the current working directory enter “$ pwd”.

It can be used for the bellow purposes

To find the full path of the current directory
Store the full path
Verify the absolute and physical path.

42. Explain the Linux ‘cd’ command options along with the description?
Answer: cd’ stands for change directory and is used to change the current directory in which the user is working.

cd syntax : $ cd {directory}

Following purposes can be served with ‘cd’ commands

Change from current to a new directory
Change directory using the absolute path
Change directory using the relative path
Few of the ‘cd’ options are enlisted below

cd~: Brings you to the home directory
cd-: Brings you to the previous directory
. : Bring you to the parent directory
cd/: Takes you to the entire system’s root directory

43. What is know about grep commands?
Answer: Grep stands for ‘global regular expression print’. This command is used for matching a regular expression against text in a file. This command performs pattern-based searching and only the matching lines are displayed as output. It makes use of options and parameters that are specified along with the command line.

For example: Suppose we need to locate the phrase “our orders” in HTML file named as “order-listing.html”. Then the command will be as follows:

$ grep “our orders” order-listing.html

The grep command outputs the entire matching line to the terminal.

44. How to reduce or shrink the size of LVM partition?
Answer: Below is the logical steps to reduce the size of the LVM partition :
Unmount the filesystem using unmount command,
Use resize2fs command , e.g resiz2fs /dev/mapper/myvg-myself 10G
Now use the lvreduce command as reducing -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, the industry-led curriculum in Linux.

45. Which command is used to delete a group?
Answer: The groupdel command

46. You need to search for the string “Tecmint” in all the “.txt” files in the current directory. How will you do it?
Answer: We need to run the find command to search for the text “Tecmint” in the current directory, recursively.

47. What is the role of case sensitivity in affecting the way commands are used?
Answer: Linux is considered as cases sensitive. Case sensitivity can sometimes serve as the reason for displaying different answers for the same command as you might enter the different format of commands each time. In terms of case sensitivity, the command is the same but the only difference occurs with regard to uppercase and lowercase letters.

For example cd, CD, Cd are different commands with different outputs.

48. Torvalds, Wrote most of the Linux Kernel in C++ programming language, do you agree?
Answer: No! Linux Kernel contains 12,020,528 Lines of codes out of which 2,151,595 lines are comments. So remaining 9,868,933 lines are codes and out of 9,868,933 Lines of codes 7,896,318 are written in C Programming Language.
The remaining lines of code 1,972,615 are written in C++, Assembly, Perl, Shell Script, Python, Bash Script, HTML, awk, yacc, lex, sed, etc.

Note: The Number of Lines of codes varies on a daily basis and an average of more than 3,509 lines are being added to Kernel.

49. How do you terminate an ongoing process?
Answer: Use the kill command followed by the PID in order to terminate that process. To terminate all process at once, use kill 0.

50. What are some common things between Linux & UNIX?
Answer: Both Linux and UNIX share many common applications such as:

GUI, file, and windows managers (KDE, Gnome)
Shells (KSH, csh, bash)
Various office applications such as OpenOffice.org
Development tools like Perl, PHP, Python, GNU c/c++ compilers
Posix interface

Learn how to use Linux, from beginner basics to advanced techniques, with online video tutorials taught by industry experts. Enroll for Free Linux Training Demo!

51. What is the root account in Linux?
Answer: The root account is like a systems administrator account, and allows full control of the system.

52. How can you find out how much memory Linux is using?
Answer: From a command shell, use the “concatenate” command: cat /proc/meminfo for memory usage information.

The root account is like a systems administrator account and allows full control of the system.

53. What does (cd dir && command) do?
Answer: cd dir && command goes to the dir, execute the command and return to the current directory.

54. How can you determine the total memory used by LINUX?
Answer: It is always required to keep a check on the memory usage in order to find out whether the user is able to access the server or the resources are adequate. There are roughly 5 methods that determine the total memory used by Linux.

This is explained as below

Free command: This is the most simple and easy to use the command to check memory usage. For example: ‘$ free –m’, the options being’ displays all the data in MBs.

/proc/meminfo: The next way to determine memory usage is to read /proc/meminfo file. For example: ‘$ cat /proc/meminfo’
Vmstat: This command basically lays out the memory usage statistics. For example: ‘$ vmstat –s’
Top command: This command determines the total memory usage as well as also monitors the RAM usage.

Note: Browse latest Linux Interview Questions and Linux Tutorial Videos. Here you can check Linux Training details and Linux Training Videos for self learning. Contact +91 988 502 2027 for more information.