Did you know that more than 90% of the World’s Fastest Computers use Linux? No doubt why! Linux is fast, powerful, and a techies’ favorite. If you are looking to become a Linux Administrator, then this is the right place for you to prepare for the interview. In this article, I will be discussing some of the most common and important Linux Interview Questions and their Answers. Show
Interested in Linux Administration? Check out the Live Linux Course online. This Linux Interview Questions blog is divided into two parts: Part A-Theoretical Questions and Part B-Scenario Based Questions. Let’s get started! Part A-Theoretical QuestionsIn this part of Linux Interview Questions, we will discuss the most common theoretical and concept based questions. 1. What is Linux?Linux is an Open-Source Operating System based on Unix. Linux was first introduced by Linus Torvalds. The main purpose of Linux was to provide free and low-cost Operating System for users who could not afford Operating Systems like Windows or iOS or Unix. 2. What is the difference between Linux and Unix?The main differences between Linux and UNIX are as follows:
Linux vs. Unix – Linux Interview Questions 3. What is Linux Kernel? Is it legal to edit Linux Kernel?Linux kernel refers to the low-level system software. It is used to manage resources and provide an interface for user interaction. Yes, it is legal to edit Linux Kernel. Linux is released under the General Public License (General Public License). Any project released under GPL can be modified and edited by the end users. 4. What is LILO?LILO stands for LInux LOader. LILO is a Linux Boot Loader that loads Linux Operating System into the main memory to begin execution. Most of the computers come with boot loaders for certain versions of Windows or Mac OS. So, when you want to use Linux OS, you need to install a special boot loader for it. LILO is one such boot loader. When the computer is started, BIOS conducts some initial tests and transfers control to the Master Boot Record. From here, LILO loads the Linux OS and starts it. The advantage of using LILO is that it allows fast boot of Linux OS. 5. What are the basic components of Linux?The basic components of Linux are:
6. Which are the Shells used in Linux?The most common Shells used in Linux are
7. What is Swap Space?Swap Space is the additional spaced used by Linux that temporarily holds concurrently running programs when the RAM does not have enough space to hold the programs. When you run a program, it resides on the RAM so that the processor can fetch data quickly. Suppose you are running more programs than the RAM can hold, then these running programs are stored in the Swap Space. The processor will now look for data in the RAM and the Swap Space. Swap Space is used as an extension of RAM by Linux. 8. What is the difference between BASH and DOS?There are 3 main differences between BASH and DOS:
Bash vs Dos – Linux Interview Questions 9. What command would you use to check how much memory is being used by Linux?You can use any of the following commands:
10. Explain file permission in Linux.There are 3 kinds of permission in Linux:
You can change the permission of a file or a directory using the
Symbolic modeThe general syntax to change permission using Symbolic mode is as follows:
where
For example, if you want to set the permission such that the user can read, write, and execute it and members of your group can read and execute it, and others may only read it. Then the command for this will be:
Absolute modeThe general syntax to change permission using Absolute mode is as follows:
The Absolute mode follows octal representation. The leftmost digit is for the user, the middle digit is for the user group and the rightmost digit is for all. Below is the table that explains the meaning of the digits that can be used and their effect.
For example, if you want to set the permission such that the user can read, write, and execute it and members of your group can read and execute it, and others may only read it. Then the command for this will be:
11. What are inode and process id?inode is the unique name given by the operating system to each file. Similarly, process id is the unique id given to each process. 12. Which are the Linux Directory Commands?There are 5 main Directory Commands in Linux: pwd: Displays the path of the present working directory. Syntax: ls: Lists all the files and directories in the present working directory. Syntax: cd: Used to change the present working directory. Syntax: mkdir: Creates a new directory Syntax: rmdir: Deletes a directory Syntax: 13. What is Virtual Desktop?Virtual Desktop is a feature that allows users to use the desktop beyond the physical limits of the screen. Basically, Virtual Desktop creates a virtual screen to expand the limitation of the normal screen. There are two ways Virtual Desktop can be implemented:
Switching DesktopsIn the case of Switching Desktops, you can create discrete virtual desktops to run programs. Here, each virtual desktop will behave as an individual desktop and the programs running on each of these desktops is accessible only to the users who are using that particular desktop. Oversized DesktopsOversized Desktops do not offer a discrete virtual desktop but it allows the user to pan and scroll around the desktop that is larger in size than the physical screen. 14. Which are the different modes of vi editor?There are 3 modes of vi editor:
15. What are daemons?A daemon is a computer program that runs as a background process to provide functions that might not be available in the base Operating System. Daemons are usually used to run services in the background without directly being in control of interactive users. The purpose of Daemons are to handle periodic requests and then forward the requests to appropriate programs for execution. 16. What are the process states in Linux?The process states are as follows:
17. Explain grep command.Grep stands for Global Regular Expression Print. The grep command is used to search for a text in a file by pattern matching based on regular expression. Syntax: Example:
This command will print the count of the word “linux” in the “interview.txt” file. 18. Explain Process Management System Calls in LinuxThe System Calls to manage the process are:
And the System Calls used to get Process ID are:
19. Explain the ‘ls’ command in LinuxThe ls command is used to list the files in a specified directory. The general syntax is:
For example, if you want to list all the files in the Example directory, then the command will be as follows:
There are different options that can be used with the ls command. These options give additional information about the file/ folder. For example:
20. Explain the redirection operator.The redirection operator is used to redirect the output of a particular command as an input to another command or file. There are two ways of using this: ‘>’ overwrites the existing content of the file or creates a new file. ‘>>’ appends the new content to the end of the file or creates a new file. Suppose the content of the file is as follows: Now when you use the ‘>’ redirection operator, the contents of the file are overwritten. and when you use ‘>>’, the contents are appended: 21. Why is the tar command used?The tar command is used to extract or create an archived file. Suppose you want to extract all the files from the archive named sample.tar.gz, then the command will be:
Suppose you want to create an archive of all the files stored in the path /home/linux/, then the command will be:
where c: create archive, x: extract, v: verbose, f: file 22. What is a Latch?A Latch is a temporary storage device controlled by timing signal which can either store 0 or 1. A Latch has two stable states (high-output or 1, and low-output or 0) and is mainly used to store state information. A Latch can store one bit of data as long as it is powered on. 23. What is a Microprocessor?A Microprocessor is a device that executes instructions. It is a single-chip device that fetches the instruction from the memory, decodes it and executes it. A Microprocessor can carry out 3 basic functions:
24. Explain Regular Expressions and GrepRegular Expressions are used to search for data having a particular pattern. Some of the commands used with Regular Patterns are: tr, sed, vi and grep. Some of the common symbols used in Regular Expressions are:
Suppose the content of a file is as follows: If you want to list the entries that start with the character ‘a’, then the command would be:
If you want to list the entries that start has the character ‘n’, then the command would be:
25. What is the minimum number of disk partitions required to install Linux?The minimum number of partitions required is 2. One partition is used as the local file system where all the files are stored. This includes files of the OS, files of applications and services, and files of the user. And the other partition is used as Swap Space which acts as an extended memory for RAM. Part B – Scenario Based QuestionsInterviewers will ask scenario based questions along with theoretical questions to check how much hands-on knowledge you have. In this part of Linux Interview Questions, we will discuss such questions. 1. How to copy a file in Linux?You can use the cp command to copy a file in Linux. The general syntax is:
Suppose you want to copy a file named questions.txt from the directory /new/linux to /linux/interview, then the command will be:
2. How to terminate a running process in Linux?Every process has a unique process id. To terminate the process, we first need to find the process id. The The command for listing down all the processes:
Suppose the process id of the process you want to terminate is 3849, then you will have to terminate it like this:
3. How to rename a file in Linux?There is no specific command to rename a file in Linux. But you use the copy or move command to rename the file. Using the Move command
Using the Copy command
And then delete the old file.
4. How to write the output of a command to a file?You can use the redirection operator (>) to do this. Syntax:
5. How to see the list of mounted devices on Linux?By running the following command:
6. How to find where a file is stored in Linux?You can use the locate command to find the path to the file. Suppose you want to find the locations of a file name sample.txt, then your command would be:
7. How to find the difference in two configuration files?You can use the diff command for this:
8. Write a bash script to delete all the files in the current directory that contains the word “linux”.
9. How would you create a text file without opening it?The touch command can be used to create a text file without opening it. The touch command will create an empty file. The syntax is as follows:
Suppose you want to create a file named sample.txt, then the command would be:
10. How would you delete a directory in Linux?There are two commands that can be used to delete a directory in Linux.
Note: The command rm -rf should be used carefully because it will delete all the data without any warnings. 11. How would you schedule a task in Linux?There are two commands to schedule tasks in Linux: cron and at. The cron command is used to repeatedly schedule a task at a specific time. The tasks are stored in a cron file and then executed using the cron command. The cron command reads the string from this file and schedules the task. The syntax for the string to enter in the cron file is as follows:
Suppose you want to run a command at 4 pm every Sunday, then the string would be:
The at command is used to schedule a task only once at the specified time. Suppose you want to shut down the system at 6 pm today, then the command for this would be:
12. Suppose you try to delete a file using the rm command and the deletion fails. What could be the possible reason?
13. How do you look at the contents of a file named sample.z?The .z extension means that the file has been compressed. To look at the contents of the compressed file, you can use the zcat command. Example:
14. How to copy files to a Floppy Disk safely?Follow these steps to copy files to a Floppy Disk safely:
If you don’t unmount the floppy disk, then the data might become corrupted. 15. How to identify which shell you are using?Open the terminal and run:
This will print the name of the Shell being used. 16. How can you login to another system in your network from your system?SSH can be used for this. The Syntax is as follows:
Suppose you want to login into a system with IP address 192.168.5.5 as a user “mike”, then the command would be:
17. How would you open a file in read-only mode using the vim editor?
18. How would you search for a specific Employee ID in a file using the vim editor?
19. How to jump to a particular line in a file using vim editor?
20. How do you sort the entries in a text file in ascending order?This can be done using the sort command.
21. What is the export command used for?The export command is used to set and reload the environment variables. For example, if you want to set the Java path, then the command would be:
22. How do you check if a particular service in running?
23. How do you check the status of all the services?
24. How do you start and stop a service?To start:
To stop:
25. Explain the free command.This command is used to display the free, used, swap memory available in the system. Typical free command output. The output is displayed in bytes.
I hope these Linux Interview Questions will help you perform well in your interview. And I wish you all the best! Got a question for us? Please post it on Edureka Community and we will get back to you. If you wish to learn Linux Administration and build a colorful career, then check out our Linux Administration Training which comes with instructor-led live training and real-life project experience. This training will help you understand Linux Administration in depth and help you achieve mastery over the subject. What are the interview questions for system administrator?Interview Questions for System Administrators:. What's the most frustrating support issue you've been called to resolve? ... . Why would you not restore a DC that was last backed up eight months ago? ... . What experience do you have with hardware components? ... . What is the difference between LDAP and Active Directory?. What is System Administrator in Linux?A Linux System Administrator takes care of computers running on the Linux operating systems. The professional will handle the support infrastructure, operating systems, virtual platforms, and applications.
What are the responsibilities of Linux administrator?Linux Administrator installs, configures, and maintains Linux operating systems. Analyzes and resolves problems associated with the operating system's servers, hardware, applications, and software. Being a Linux Administrator monitors systems performance and ensures compliance with security standards.
What every Linux administrator should know?10 skills every Linux system administrator should have. User account management. Career advice. ... . Structured Query Language (SQL) ... . Network traffic packet capture. ... . The vi editor. ... . Backup and restore. ... . Hardware setup and troubleshooting. ... . Network routers and firewalls. ... . Network switches.. |