Top linux interview questions and answers


13 March, 2021


N
 Nick C  10 minute read

Introduction

More than 90% of cloud services use linux as underlying operating system. This is because linux is fast, has a beautiful system architecture and it is techies' favorite OS. Linux is a must know by all people that are into computing technologies, whether you are a front-end developer or SEO specialist. In this blog post we will be discussing most common linux interview questions, this question can be referred to you even you are not a linux system administrator, it is just a good practice to know the answer to them.

Theoretical questions

1 - What is Linux?

Answer:
Linux is a unix-like operating system based on Linux kernel. Linux was first introduced by Linus Torvalds, the purpose of that system was to provide a simple to use and low-cost Operating system for non windows or iOS users.

2 - What are the basic components of Linux?

Answer:

linux-architecture
  • Kernel - the main component of a Linux operating system (OS) and is the core interface between a computer's hardware and its processes.
  • Shell - is the command interpreter of Linux operating system, it is used to run commands.
  • Graphical User Interface (GUI) - it is another (simpler) way to interact with linux system, when compared to command line, gui has buttons, icons, textboxes to interact with.
  • System Utilities - tools that allow user to manage the linux system, for example system tools that can change information related to data sets and volumes.
  • Application Programs - these are software programs that are used to accomplish a specific task, these applications are designed for end user, for example a text editor, web browser, email client etc.

3 - What are some of the most popular linux commands you know?

Answer:
Bellow is shown the most common linux commands

linux-commands

4 - What is inode in linux?

Answer:
inode is a data structure that has the goal to store information about a Linux file, for example access mode, metadata (times of last change, modification),

5 - Name some linux directory related commands.

Answer:

  • ls - list all the files in the present working directory
  • cd - change directory
  • mkdir - creates a new directory
  • pwd - prints the present working directory
  • rmdir - used to delete a directory

6 - What are the 5 process states in Linux?

Answer:

  • Ready - The process is created and is ready to run
  • Running - The process is executed and running
  • Blocked or wait - The process is waiting for use input
  • Terminated or Completed - The process is terminated or completed by the operating system
  • Zombie - The process is terminated but the information is still present in the process table

7 - What is the tar command and how it can be used?

Answer: Tar is used to archive or extract and archived file. To extract all files from an archive, let's say is named sample.tar.gz, we need to run this command:
tar -xvzf sample.tar.gz
Now, let's say we need to archive all files stored in a path, for example /home/some_user/, then the command will be:
tar cvf file_name.tar /home/some_user/

8 - What is the free command in linux?

Answer:
This command is used to display the free, used and swap memory available on the system

free-linux-command

9 - What is the export command used for?

Answer:
Export command is used to set environment variables to linux system. For example we can change the Java path using this command: export JAVA_HOME = /home/your_user/Java/bin

10 - How can you login/connect to another remote server in Linux?

Answer:
SSH command is used to achieve this. Secure socket shell is a protocol is used to connect to a remote computer using a text-based interface. When the ssh connection is succeeded, a shell session will be started on that server, and you can run basic linux commands. To connect to a remote server we need to run this command:
ssh your_username@host_ip_address

11 - How can you identify which shell you are currently using?

Answer:
We need to open the terminal and run this command: echo $SHELL

12 - What is a .z extension and what you know about it?

Answer:
The .z extension means that the file was compressed, so that more space can be saved on the disk. This file can be handled using the Compress or Decompress commands. To look at the contents of compressed file we can run: zcat file.z
To uncompress just run this command: uncompress file.z To compress run this command: compress file

13 - What commands are used to schedule a task in Linux?

Answer:
There are 2 commands used for this: cron and at
Cron command is mainly used to repeat a scheduled task over a specific time. A cron file is used to store information about the task. The cron command then reads the string from this file and schedules the task. The syntax to enter in the cron file is as follows: <minute> <hour> <day> <month> <weekday> <command>
For example to run a job every friday we need this settings: 0 0 * * FRI
When compared to cron, the at command is used to schedule a task only once at a specified time, for example to run a command at 9:00 we run: echo "command_to_be_run" | at 09:00

14 - How to you remove a directory in Linux?

Answer:
There are 2 commands we can run to remove a directory. First is: rmdir dir_name and the other one is rm -rf dir_name

15 - How do you create a file without opening it using command line?

Answer:
Touch is used to create files, for example touch sample.txt. We can also paste text inside the file without opening it using this command: echo "some text" >> sample.txt

Best ways to learn linux commands

So what is the most effective way to learn linux commands? Well, the answer is definitely to practice, and what is the best platform to practice it? It is querial, here you can find many quizzes, including programming languages.

querial-linux-quiz

Here you can track the progress of your knowledge, just visit linux quiz, train your skills and see how well you perform. Quizzes are the best option because it is easy to memorise and what is event more important that this way you memorise linux commands easier.

Summary

Linux commands are definitely a must know for any IT person. No matter what side of computing technologies you decide to learn, knowing the basics of linux is always helpful, even more, when passing an interview, it is very common to get linux questions. There are many ways that can make you learn linux fast, but the best one is of course to practice over and over again. So why not join querial today and practice our linux questions.


Share:

Related Blogs

Learn countries and capitals of the world

01 January, 2020

There are over 195 countries and more than 10000 cities around the globe. It is quite challenging to remember them, yet this is possible to achieve by anyone.

How to learn the flags of the world?

09 January, 2021

Every country has a flag. This is the element that is always associated with a country, the flag describes the country and represents the history of it.