1. What operating system is Linux based on?

Ans. UNIX

  1. What is the difference between Linux and UNIX?

Ans. The differences between Linux and Unix are: 

Linux

Unix

It is an operating system used for computer hardware & software, game development, and more.

Unix is an operating system used in Intel, HP, internet servers, and more.

It has both free distributions and paid versions are available.

Different versions of UNIX have different cost structures.

It can be used by anyone including home users, developers, etc.

It is mainly used in mainframes, internet servers, and workstations.

The file support system includes Ext2, Ext3, Ext4, Jfs, ReiserFS, Xfs, Btrfs, FAT, NTFS. 

The file support system includes jfs, gpfs, hfs, ufs, vxfs.

It offers two GUIs: KDE and Gnome.

The common desktop environment serves as a GUI.

Offers higher security. It has around 60-100 viruses listed to date.

It is also highly secured and has around 85-120 viruses listed to date.

Examples: Red Hat, Fedora, Kali Linux, Debian, Android, Ubuntu.

Examples: Solaris, OS X, All Linux.

  1. Is it legal to edit the Linux kernel?

Ans. Yes, as it is under General Public License (GPL), and anyone can edit.

  1. What are the basic components of Linux?

Ans. This is one of the popularly asked Linux interview questions. The Linux operating system consists of the following three components:

  1. Kernel:It is the core part of Linux and is responsible for all major activities of the operating system. Linux Kernel is free and open-source software that manages hardware resources for the users. It consists of various modules and interacts directly with the underlying hardware. Kernels prevent conflicts between different processes. Different types of the kernel are: 
  • Monolithic kernels
  • Exo kernels 
  • Hybrid kernels
  • Micro kernels
  1. System Library:System libraries are special functions using which application programs access Kernel’s features. System libraries are responsible for implementing most of the functionalities of the operating system. They do not require kernel module’s code access rights.
  2. System Utility:These programs are responsible for performing specialized, individual-level tasks.
  3. What is LILO?

Ans. LILO stands for Linux Loader and is a boot loader to load the operating system in the main memory.

  1. Which command would you use if you want to remove the password assigned to a group?

Ans. The gpasswd – r removes the password assigned to a group.

  1. What is BASH?

Ans. BASH is short for Bourne Again SHell. Written by Steve Bourne, it acts as the default shell for most Linux systems since it has been adapted.

  1. What is the difference between BASH and DOS?

Ans. This is one of the most commonly asked Linux interview questions.

There are three key differences between BASH and DOS:

  • BASH commands are case sensitive while DOS commands are not
  • BASH follows no convention in naming files, while DOS follows a convention
  • Under BASH, / character serves as a directory separator while in DOS \ serves as the directory separator.
  1. What is the alternative method for a GUI installation in Linux?

Ans. Linux provides textbase installation as the alternative method of GUI installation.

  1. What is the root account in Linux?

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

  1. How can you find out how much memory Linux is using?

Ans. From a command shell, use the “concatenate” command: cat /proc/meminfo for memory usage information.

  1. Does the Ctrl+Alt+Del key combination work on Linux?

Ans. Yes

  1. How do you create a new user without logging on as a root user?

Ans. Using the su command.

  1. What is the minimum number of partitions that you need to install Linux?

Ans. Minimum two partitions are needed for installing Linux.

  1. Which command would you use to create a file system on a new hard drive?

Ans. The mkfs command

  1. Which command is used to review boot messages?

Ans. The dmesg command

  1. Which file is used to automatically mount file systems?

Ans. Fstab file

  1. What is the difference between internal and external commands?

Ans. Internal commands are those that are already loaded in the system. External commands are those which can be executed at any time and are independent.

  1. What is the difference between the home directory and the working directory?

Ans. The home directory is the default working directory when a user logs in.

The working directory is the user’s current directory.

  1. Which daemon controls the print spooling process?

Ans. The line printing daemon

  1. How can you check the memory status?

Ans. free -m to display output in MegaByte

  1. Explain how to uninstall the libraries in Linux?

Ans. By using the command, sudo apt-get remove library_name

  1. Which command is used to delete a group?

Ans. The groupdel command

  1. How do you terminate an ongoing process?

Ans. Use the kill command followed by the pid in order to terminate that process. To terminate all processes at once, use kill 0.

  1. Can Linux computers be made a router so that several machines may share a single Internet connection? How?

Ans. Yes, by IP masuerading

  1. What daemon is used for scheduling of the commands?

Ans. The crontab command

  1. Name the different modes used with vi editor?

Ans: Following are three different types of modes in vi editors:

  • Insertion Mode/Edit Mode
  • Command Mode/ Regular Mode
  • Ex Mode/ Replacement Mode            
  1. What are File Permission groups in Linux?

Ans: Following are three user based permission groups for each file and directory:

  • Owner
  • Group
  • All Users
  1. Name the different types of file systems in Linux.

Ans: There are different types of file systems in Linux:

  • Ext
  • Ext2
  • Ext3
  • Ext4
  • JFS
  • XFS
  • Btrfs
  • Ufs
  • Autofs
  • Devpts
  • Ntfs
  • swap
  1. What is the procedure to set the umask permanently for a user? 

Ans: If the umask command is used without any arguments, it means it will display the current mask. 

There are two types to set the umask permanently:

  • Ocotal representation.
  • Symbolic representation.
  1. How to set the umask command permanently for a user? 

Ans: If the umask command invoked without any arguments, it means it will display the current mask. 

There are two types to set the umask permanently:

  • Ocotal representation.
  • Symbolic representation.
  1. What is the procedure to convert the default run level in Linux?

Ans: To convert the default run level in Linux, we can use the init command. 

  1. How to share a directory with the help of nfs?

Ans:  To share a directory with the help of NFS, we have to edit the configuration file, ‘/etc/exports’, and add an entry like directory name ‘/’. Then, restart the NFS service.

  1. How can we lock the user account in Linux?

Ans: We can lock user account for the security of users so that unauthorized users cannot log in. There are a few ways to lock the user account:

  • Disable the password with the help of passwd command.
  • Delete the user account with the help of usermod command or change command.
  • Switching the shell using nologin command ( /sbin/nologin ).
  1. Explain the grep command in Linux?

Ans: grep command is used to the global search for regular expressions.

Syntax:

grep [options] pattern [files]

  1. What is the role of the cp command in Linux?

Ans: cp command in Linux is used to copy files and directories. We can also use it for the backup of files or directories.

Syntax: $ cp file name

  1. What is the rmdir command in Linux?

Ans: The rmdir command in Linux is used to remove each directory stated on the command line. 

Syntax: 

rmdir [-p] [-v | –verbose] [–ignore-fail-on-non-empty] directories 

  1. Mention some Linux file content commands?

Ans: Following are some file content commands:

  • head: Display the top lines of the file.
  • tail: Display the last lines of the file.
  • cat: Concatenate more than two files.
  • more: Display the content in pager form to view in the terminal. 
  1. Explain what PIPE in Linux is?

Ans: A pipe is a form of redirection in Linux, it is mainly used to combine two or more than two commands, and the output of one command can take as input to the next command. 

Syntax:

command_1 | command_2 | command_3 | …. | command_N

  1. Explain lsof command in Linux?

Ans: lsof command is used to list the open files assigned to the application.

  1. Explain the df command in Linux?

Ans: The df (display free disk space) command is used to troubleshoot disk space problems. 

df Command Example:

df -h

  1. Explain what does (cd dir && command) do?

Ans: The cd dir && command moved to the dir and used to execute the command, then returns to the current directory.

  1. What is the role of pushd command in Linux?

Ans: The pushd command is used to put recent dir on the stack so that it can pop back to it.

  1. What is CLI? What are its advantages and disadvantages? 

Ans. This is one of the most important Linux interview questions for experienced candidates. CLI stands for Command Line Interface. It is a non-graphical, text-based interface that enables users to interact with computers. Using the Linux interface, users can type declarative commands and instruct the computer to perform operations. It is based on the response transaction process and offers great flexibility.   

Advantages of CLI:

  • A lot faster and efficient to use by experts (those who know the commands).
  • Offers great flexibility.
  • Does not use much CPU processing time.
  • Does not require Windows to run.
  • Needs fewer resources.
  • Needs much less memory (Random Access Memory).

Disadvantages of CLI: 

  • It can be very confusing for new users.
  • Requires a lot of commands to be learned and remembered.
  • Commands need to be typed precisely. If there is a spelling mistake then the command will not respond or fail.
  1. What are symbolic links?

Ans. A symbolic link or symlink in Linux is a file that points to another file or a folder on the computer. It functions like shortcuts in Windows. It enables you to instantly access programs, files, or directories without having to go directly to the entire pathname. Symbolic links are also called ‘soft links’. 

Features of Symbolic Links: 

  • A symbolic link is similar to the file shortcut feature in Windows Operating systems. 
  • They can be linked across different file systems.
  • They contain the path for the original file and not the contents.

Syntax:

ln -s [target file] [Symbolic filename]

  • -s – to create a soft (symbolic) link
  • [target file] – the name of the existing file for which you are creating the link
  • [Symbolic filename] – the name of the symbolic link
  1. How do you change permissions under Linux?

Ans. chmod (change mode) command is used to change file and directory permissions in Linux. The chmod command consists of at least three parts from the following: 

Access class

Operator

Access Type

u (user)

+ (add access)

r (read)

g (group)

– (remove access)

w (write)

o (others)

= (set access)

x (execute)

a (all)

  

Example: 

An owner of a file or directory can change permissions using the following command. 

  • chmod +rwx filename to add permissions.
  • chmod -rwx directoryname to remove permissions.
  • chmod +x filename to allow executable permissions.
  • chmod -wx filename to take out write and executable permissions.
  1. What are the features of Linux?

Ans. This is one of the basic Linux interview questions that you must prepare for your interview.

Following are some of the features of Linux:

  1. Multitasking: Supports more than one function simultaneously by dividing the CPU time.
  2. Multiuser capability: Allows multiple users to access the same system resource using different terminals for operation.
  3. Portable: Linux Kernel and application programs can be installed on any kind of hardware platform. 
  4. Application support: Has its own software repository to download and install applications.
  5. Security: Provides security in three ways namely, authentication, authorization, and encryption.
  6. Hierarchical File System: Provides a standard file structure in which system files and user files are arranged.  
  7. Open Source: Code is freely available to all. 
  8. Live CD/USB: Provide a live CD/USB so that users can run it without installing it. 
  1. What are the different types of Process Management System Calls in Linux?

Ans: The process management uses certain system calls. They are: 

fork ()

create a new process

exec ()

execute a new process

wait()

wait until process execution

exit()

terminate the process

getpid ()

to find the unique process id

getppid()

to find the parent process id

nice ()

bias the currently running process property

  1. Which Shells are used in Linux?

Ans. Some of the commonly used Shells in Linux are:

  • Bash: It stands for Bourne Again Shell. It is the default for most Linux distributions.
  • Ksh: Ksh stands for Korn shell. It is a high-level programming language shell. 
  • Csh: The C Shell follows C-like syntax. It offers spelling correction and job control.
  • Zsh: Z Shell is an interactive shell that offers some unique features like startup files, login/logout watching, closing comments, and more. It incorporates some features of other Linux shells such as Bash and Ksh. 
  • Fish: It stands for Friendly Interactive Shell and provides some unique features like man page completions, web-based configuration, auto-suggestions, and fully scriptable with clean scripts. It is fully interactive and user-friendly like other shells. 
  1. What are the different process states in Linux?

Ans. This is a popular Linux interview question that must prepare for.

Linux has the following process states: 

  • Ready: The process has been created and is ready to run.
  • Running: The process is being executed and using the CPU at a particular moment.
  • Waiting: Process is waiting for an event to occur or for a system resource.
  • Terminated/Stopped: A process has been stopped, usually by receiving a signal.
  • Zombie: The process is terminated, but still has an entry in the process table.
  1. What are Daemons in Linux? 

Ans. This is another popular Linux interview question. Daemons are the programs on Unix-like operating systems that run in the background instead of running under the direct control of a user. In Linux, daemons extend the functionality of the base operating system by offering functions that might not be available in the operating system. 

A daemon actively listens for a service request and acts upon it at the same time. On completion of service, the daemon gets disconnected and waits for further requests. 

Most have a ‘d’ at the end of the process name. Some of the service daemons for Linux systems are:  

  1. amd – Auto Mount Daemon
  2. ftpd – FTP Server Daemon
  3. httpd – Web Server Daemon
  4. mysl – Database server Daemon
  5. nfsd – Network File Sharing Daemon
  6. sshd – Secure Shell Server Daemon

 

By bpci