Debug School

rakesh kumar
rakesh kumar

Posted on

Linux Interview Question

linux-interview-questions-for-beginners

What command would you use to check how much memory is being used by Linux?

free -m
vmstat
top
htop
Enter fullscreen mode Exit fullscreen mode

If you want to list the entries that start with the character ‘a’, then the command would be:

cat linux.txt | grep ^a
Enter fullscreen mode Exit fullscreen mode

How to find the difference in two configuration files?

diff abc.conf xyz.conf
Enter fullscreen mode Exit fullscreen mode

Write a bash script to delete all the files in the current directory that contains the word “linux”

for i in *linux*; do rm $i; done
Enter fullscreen mode Exit fullscreen mode

How would you schedule a task in Linux?

<minute> <hour> <day> <month> <weekday> <command>
Enter fullscreen mode Exit fullscreen mode

Suppose you want to run a command at 4 pm every Sunday, then the string would be:

0 16 * * 0 <command>
Enter fullscreen mode Exit fullscreen mode

Suppose you want to shut down the system at 6 pm today, then the command for this would be:

$ echo "shutdown now" | at -m 18:00
Enter fullscreen mode Exit fullscreen mode

How would you open a file in read-only mode using the vim editor?

vim -R <filename>
Enter fullscreen mode Exit fullscreen mode

How would you search for a specific Employee ID in a file using the vim editor?

vim +/<employee id to be searched> <filename>
Enter fullscreen mode Exit fullscreen mode

How to jump to a particular line in a file using vim editor?

$ vim +<line number> <filename>
Enter fullscreen mode Exit fullscreen mode

How do you sort the entries in a text file in ascending order?

 sort sample.txt
Enter fullscreen mode Exit fullscreen mode

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:

export JAVA_HOME = /home/user/Java/bin
Enter fullscreen mode Exit fullscreen mode
  1. 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.

  1. 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.

  1. What are the basic components of Linux? The basic components of Linux are:

Kernel: It is the core component of the Operating System that manages operations and hardware.
Shell: Shell is a Linux interpreter which is used to execute commands.
GUI: GUI stands for Graphical User Interface which is another way for a user to interact with the system. But unlike CLI, GUI consists of Images, Buttons, TextBoxes for interaction.
System Utilities: These are the software functions that allows the user to manage the computer.
Application Programs: Software programs or set of functions designed to accomplish a specific task.

  1. Which are the Shells used in Linux? The most common Shells used in Linux are

bash: Bourne Again Shell is the default for most of the Linux distributions
ksh: Korn Shell is a high-level programming language shell
csh: C Shell follows C like syntax and provides spelling correction and Job Control
zsh: Z Shell provides some unique features such as filename generation, startup files, login/logout watching, closing comments etc.
fish: Friendly Interactive Shell provides some special features like web-based configuration, auto-suggestions, fully scriptable with clean scripts

  1. 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.

  1. What is the difference between BASH and DOS? There are 3 main differences between BASH and DOS:

Top comments (0)