Part-1: Basic 10 Linux Interview Questions and Answers

Posted by

In this article, we’ve included 10 basic Linux Interview Questions and detailed answers, which help the candidates to prepare for the Linux interview.

These Linux interview questions and answers will be useful for both freshers and experienced users.

Q.1) What’s Linux?

Linux is a Unix-based open source multitasking and multiuser computer operating system. It was created by Linus Torvalds and released on September 17, 1991.

It supports different hardware manufactured by Intel, HP, IBM, Cisco, Dell, Lenovo and Supermicro.

Q.2) What’s UNIX?

UNIX is a multitasking and multiuser proprietary computer operating system developed by Bell Labs Research Center and released in November 1971. It was later converted into different commercial versions such as HP-UX, AIX and Solaris.

Q.3) What is the difference between Linux and Unix?

The table below shows the difference between Linux and Unix.

S.NoLinuxUnix
1It is an open-source operating system that is available for free to everyone.It’s proprietary operating system
2Linux was developed by a community of developers around the world.Unix was developed by AT&T Labs.
3The default shell is BASH (Bourne Again SHell).It uses Bourne shell as default
4Linux is used everywhere like servers, PC, smartphones, tablets, mainframes and supercomputers.It is mostly used on servers.
5Linux operating system offers CLI and GUI environment.Initially based on the CLI, but later the GUI was developed.
6It has multiple distros like Fedora, Debian, Red Hat, etc,.IBM AIX, HP-UX and Sun Solaris.

Q.4) What’s Kernel?

Kernel is heart of the operating system. It is the main component of the Linux operating system (OS), and is the core interface between the computer’s hardware and its processes.

It effectively manages system resources such as memory management, process management, and Device Management.

  • The memory management keep track of how much memory is used by system resources.
  • The process management determine which processes can use the central processing unit (CPU) and for how long.
  • The Device driver acts as a bridge between the hardware and processes.

Can you list out types of kernels?

  • Microkernel
  • Monolithic Kernel
  • Hybrid Kernel

Which kernel is used in Linux

The Linux kernel is monolithic, which loads user services and the kernel services in the same memory space. It means, the entire operating system is virtually working in kernel space.

How can I verify which kernel I am using on my Linux system?

You can find out which version of the Linux kernel is running on your system using the 'uname' command.

uname -a

Linux 2daygeek 5.3.18-59.19-default #1 SMP Tue Aug 3 14:11:23 UTC 2021 (055c4fd) x86_64 x86_64 x86_64 GNU/Linux

Q.5) What’s Shell or Bash in Linux?

Shell is a command-line interpreter that provides the interface between the user and the operating system.

Bash refers to the Bourne Again shell, which is the default shell used in Linux, but you can use other shells if you needed.

Can you list types of shells?

The below 6 shells that are most commonly used in Linux

  • GNU Bourne-Again Shell (bash)
  • Korn Shell (ksh)
  • Bourne Shell (sh)
  • C Shell (csh)
  • Z Shell (Zsh)
  • Friendly interactive shell (Fish)

How do I find out what shell I am using?

You can view your default shell using the ‘echo’ command with ‘$SHELL’ variable as shown below.

echo "$SHELL"

/bin/bash

How do i check the current shell I’m working on?

If you want to find the current shell that you are working on, run: This output may differ from the above output when you use a different shell to run an application.

echo $0

bash

How do I find my shell version using a Linux command?

If you want to know the version of your default login shell, run:

$SHELL --version

GNU bash, version 4.4.23(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

How do I change my default shell in Linux?

You can use the ‘chsh’ command to change the user login shell permanently.

Your default shell is ‘bash’ according to the above output. To change the default shell from ‘bash’ to ‘zsh’, run:

chsh -s /bin/zsh

Make a note: You must log out and login again to see this change.

How do I check how many shells are installed?

The following command will list all the installed shells on your Linux system.

cat /etc/shells

/bin/bash
/bin/csh
/bin/dash
/bin/false
/bin/ksh
/bin/ksh93
/bin/sh
/bin/tcsh
/bin/true
/bin/zsh
/usr/bin/csh
/usr/bin/dash
/usr/bin/ksh
.
.

Q.6) What is Command-line Interface (CLI) in Linux?

CLI stands for Command Line Interface. This is a text-based interface, called Linux Terminal, that allows the user to type in any Linux commands that need to be executed by the operating system.

CLI is very powerful and easy for NIX guys because most Linux server operating systems only runs with CLI.

Q.7) What is Graphical User Interface (GUI) in Linux?

GUI refers to the graphical user interface. It’s like the Windows operating system, which comes with a graphical user interface where you can easily search and open any applications you need.

Linux operating systems offer a wide range of desktop environments (DE) such as GNOME, Cinnamon, KDE, XFCE, and Deepin.

Q.8) What is the Linux File system Hierarchy Standard (FHS)

File System Hierarchy Standard (FHS) Defines the structure of file systems on the Linux operating system.

Everything in Linux is a file, you can modify it whenever needed, but make sure you are making the right changes. If you make a mistake, this can lead to other problems too.

The root directory “/” is the primary directory of the entire Linux file system hierarchy, containing all other directories and files. Make a note / and the /root is different.

Q.9) What is FileSystem in Linux?

FS is short for file system, which is used to organize files on the Linux system and controls how the data is stored and retrieved from the disk.

Each file system has two control modules, one containing the file system information and the other containing the inode information.

Inode (metadata) contains information about individual files and directories (file name, file types, permissions, owner name, group name, size, timestamps, elimination time, hard link and soft link, location, etc.)

The inode number is also called the index number, which contains the above parameters.

Linux supports multiple file system types such as ext, ext2, ext3, ext4, hpfs, iso9660, JFS, minix, msdos, ncpfs nfs, ntfs, proc, Reiserfs, smb, sysv, umsdos, vfat, XFS, xiafs.

how to check mounted file system type in Linux

Use ‘df’ command with 'T' option to display information about mounted file systems type:

df -hT

Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs          tmpfs     3.9G     0  3.9G   0% /dev/shm
tmpfs          tmpfs     3.9G  385M  3.5G  10% /run
tmpfs          tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/vda1      xfs       160G   61G  100G  38% /
tmpfs          tmpfs     783M     0  783M   0% /run/user/0

Q.10) How do i choose a partition scheme for Linux operating system?

It’s recommended to create a following partitions scheme for Linux operating systems.

  • swap
  • /
  • /boot
  • /home
  • /usr
  • /var
  • /opt
  • /tmp

Wrapping Up

In this guide, we’ve included the most frequently asked 10 basic Linux Interview Questions and detailed answers for your reference purpose and we hope it will be very useful.

If you have any questions or feedback, feel free to comment below.

Leave a Reply