When applying for a Linux position, familiarizing yourself with an appropriate set of Linux-related questions gives you a competitive edge. In an effort to prepare you for that important Linux interview, we have compiled some of the top Linux security interview questions and answers. Studying these questions benefits both freshers and experienced ones.
Linux is referred to as the most used OS in the market for its efficiency and fast performance. According to research Linux's average salary ranges from $107,805 to $179,000. So, you have wonderful opportunities as a Linux Developer.
Here we have compiled Linux Interview Questions and Answers and presented them in this blog based on the opinion of Linux Experts. These Interview Questions will definitely help you in your interview. We divided the Interview Questions into four categories as Basic, Admin, Technical and Command based Questions.
We have categorized Linux Interview Questions - 2023(Updated) into 5 levels they are:
Ans: Linux is an operating system, which is based on Linux Kernel. It is an open-source operating system where it can run on different hardware platforms. It provides a free and low-cost operating system for users. It is a user-friendly environment where they can easily modify and create variations in the source code.
If you want to enrich your career and become a professional in Linux, then enroll in "Linux Online Training" - This course will help you to achieve excellence in this domain. |
Ans: Linus Torvalds created Linux. Linus Torvalds was a student at the University of Helsinki, Finland in 1991. He started writing code on his own to get the academic version of Unix for free. Later on, it became popular as Linux Kernel.
Explore Linux Tutorial for Beginners for more information |
Ans: Here is the difference between Linux and Unix - mentioned below
Linux
|
Unix
|
Both paid and free distributions are available.
|
Different paid structures for different levels of Unix.
|
Linux primarily uses GUI with an optional command-line interface
|
Unix uses the command-line interface
|
Linux OS is portable and can be executed on different hard drives
|
Unix OS is not portable.
|
Linux is developed by a worldwide Linux community.
|
Unix is developed by AT&T developers.
|
Linux is free. And it is download through the internet under GNU licenses.
|
Most Unix Like Operating Systems is not free.
|
Linux is used at home-based PC's, phones, etc.
|
Unix is used in server systems.
|
And some other differences.
Linux is a Unix clone. But if you consider Portable Operating System Interface (POSIX) standards then Linux can be considered as UNIX.
All Linux distributions include GUI system, GNU utilities, installation & management tools, GNU c/c++ Compilers, Editors (vi), and various applications like OpenOffice, Firefox.
UNIX operating systems are considered a complete OS as everything come from a single vendor.
Linux comes with an open-source Netfilter and IPTables-based firewall tool to protect your server and desktop from crackers and hackers. UNIX operating systems come with their own firewall products.
UNIX and Linux come with their own set of tools for backing up data to tape and other backup media. However, both Linux and UNIX share some common tools such as tar, dump/restore, and cpio, etc.
Related Article: Linux vs Unix - Differences |
Related Article: Linux Operating System Introduction |
Ans: Linux kernel is the heart of the operating system. It acts as a bridge between software and hardware. If Software requests the hardware, then the kernel delivers the data between software and hardware.
For example, if you want to play a song you should launch your default player, it requests the kernel to play a song, now the kernel will contact the hardware to seek the permissions or to seek the hardware components like if you plugged in any headset to the device. Most Android phones use Linux kernels.
Yes, the kernel can edit, because it is released under General Public License.
Ans: Bash is a Unix shell and command processor written by Brian Fox for the GNU project. It is free software and acts as a replacement for Bourne Shell. It is an interpreted and not compiled process which can also be run in the terminal window.
This allows users to write commands and cause actions. Bash is capable of reading commands from shell scripts.
Ans: LILO means Linux Loader is a boot loader that is used for the Linux operating system. Most of the Linux Operating systems use LILO, to boot the operating system into main memory to start the operations.
Ans: CLI means Command language Interpreter. It interacts with the computer program, where the user issues command in the form of text lines. It Interacts with the computer terminals also, the interface accepts the text lines and converts them as a command to the operating system.
Ans: Linux was one of the first open-source technologies, many programmers added software that completely open to the users, which means you can download the file and change the code as you like. It has a wide range of options for users and increased security.
Ans: Disadvantages of Open Source Operating System mentioned below
Ans: Shell is a computer program that acts as an interface between the user and the kernel. Users can communicate with the kernel by writing programs, commands, and scripts on the shell. It accepts human-readable commands and converts them into kernel-understandable language.
Ans: They are five Shells in Linux:
Learn about Linux Monitoring Tools |
Ans: Basic components of Linux
Ans:
Launch your terminal by pressing CTRL+ALT+T or by giving terminal in the menu search bar.
Ans: Swap Space is used when the physical Ram memory is running out. It will move the Ram inactive pages to the swap space. It can consider in the form of a dedicated swap partition or swap files.
Ans: GUI means Graphical User Interface. It is a human-computer interface that uses windows, images, icons, and menus which can be manipulated by using a mouse. Most of the modern applications in electronic gadgets communicate with the user through GUI. GUI is a combination of graphical and textual interaction that uses buttons, menus, message boxes, etc.
Ans: Linux file permissions - Each file or directory has 3 permissions
They are
Related Article: Linux File Permissions |
Ans: They are dynamic values that affect the process of programs on a computer. They exist in every operating system and their types may vary. They can be created, edited, saved, and deleted and they also give information about the system's behavior.
Ans: It will be redirected to another file using its path. Target files do not contain any data. Symbolic links redirect to another entry somewhere in the file system. If the target file is deleted, the link to that file is removed, but not the file.
Ans: A hard link is another name for an existing file on Linux. We can create so many numbers of hard links, for any file. They can create links for other hard links.
Ans: Redirection can be defined as changing the standard input and output devices. To redirect metacharacters are used, you can redirect the file or program.
Ans: A Daemons is a background process that accepts requests for service from other computers, most of operating systems use daemons in other forms.
Checkout Linux Certification Course in Hyderabad |
Ans: The root is the user name, which default has access to all files and commands. The root user can do many things, but an ordinary user cannot do like installing software, changing file permissions, etc.
Ans: Virtual Desktop is a user interface when you are facing the problem of how to manage multiple windows on your desktop, virtual desktop serves as an alternative. Virtual desktop stores remote server and allow you to use one or more programs on a clean slate.
Ans: There are three kinds of modes in vi editors. They are
Ans: The inode is a unique name given to each file and the process id is a unique name given to each process.
Ans: Five process states in Linux. They are
Ans: The process management system calls in Linux:
System calls to get the Process id :
Ans: There are three user-based permission groups for each file and directory.
They are:
Ans: Linux file system stores and handles the data. Without a file system, it cannot know where the file starts from and where the file ends.
Ans: In Linux, there are many file systems:
Ext, Ext2, Ext3, Ext4, JFS, XFS, btrfs, ufs, autofs, devpts, ntfs and swap.
Ans: LVM stands for Large Volume Management, it is a storage management device. Users can create, resize, and delete LVM partitions. It increases abstraction, flexibility, and control. LVM is used to gather existing storage devices into the group and allocate logical units.
Ans: unmask stands for user file creation mode. When the user creates any file, it has default file permissions. So unmask will specify few restrictions to the newly created file (it controls the file permissions).
umask [-S] [mask]
Ans: If the unmask command invoked without any arguments, it means it will display the current mask.
To set the unmask permanently, we have two types.
They are:
Ans: Network Bonding is a process of combining more than two network interfaces to form a single network interface. It offers performance improvement and redundancy by increasing network throughput and bandwidth.
No need to worry if one interface is down or unplugged because the other will work. The behaviour of the bonded interface depends on the bonding method.
Ans: Different modes of Linux network bonding
Ans: To display the default route and routing table, we use the following commands.
$ route-n
$ nestat-rn
$ ip
Ans: We have two commands to check which ports are in listening in Linux Server. Following are the two commands
# netstat --listen
# netstat -l
Ans: lib/modules/kernel-version/, this directory stores all the information about the compiled drives under the Linux system. Using lsmod command also we can see the installed kernel modules.
Ans: To change the default run level in Linux use the init command.
Ans: To share a directory using NFS, first edit the configuration file and ‘/etc/exports’ and add an entry like directory name ‘/<directory-name>’. Now restart the NFS service.
Ans: Details mentioned below
Service
|
Port
|
SMTP
|
25
|
DNS
|
53
|
FTP
|
20(Data Transfer) 21(Connections Established)
|
DHCP
|
68(dhcp client), 67(DHCP server)
|
SSH
|
22
|
Squid
|
3128
|
Ans: Locking user account is done for the security purpose so that unauthorized users cannot log in. So, we have a few ways to lock the user account. Some of them are below.
Ans: It is one of the basic commands in Linux. It is used to list all the files and directories in the file system.zom
Syntax:
ls [OPTIONS] [FILES]
We can use it without passing the arguments, then it will list all the files in the current working directory. Files will be displayed in alphabetical order.
Is
To list the specific directory files use the directory name in the syntax, follow as shown in the below syntax.
ls /etc
We can also pass multiple directories names in the syntax, but separated by space.
ls /etc /var /etc/passwd
Ans: The Tail command print the last N number of lines of the given data, it prints 10 lines by default.
Syntax:
tail [OPTION]... [FILE]
Example:
$ cat names.txt
Tableau
sql server
linux administration
Now, check the syntax without giving any option or input.
$ tail state.txt
Ans: grep command is a filter that is used to the global search for regular expressions.
Syntax:
grep [options] pattern [files]
Ans: The ps command displays the current process status of the system. And it displays the processes id’s with some other related data also.
Syntax:
Ps [options]
Output:
[root@rhe17~]# ps
PID TTY TIME CMD
12330 pts/0 00:00:00 bash
21621 pts/0 00:00:00 ps
Related Article: Linux Commands with Examples |
Ans: env is a shell command is used to print a list of current environmental variables and it can run another process in another environment without any modification of the current environment.
env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
Tag
|
Description
|
-i, --ignore-environment
|
Start with an empty environment.
|
-0, --null
|
output line End with a 0 (null) byte rather than a newline.
|
-u, --unset=NAME
|
removes variable NAME from the environment
|
--help
|
Display a help message and exit.
|
Ans: The top command is used to show the system process and it displays and updates the sorted process information.
Ans: netstat command gives various information about the network and routing tables, interface statics and more about the system.
Ans: lsof means List of files, we can know which file is opened by which process.
#lsof
-
Ans: This command is used to change the permission of files and directories. It’s an important command so, I'll explain it briefly. Therefore, on the whole, there are three ty0pe of permission, read, write and execute and are represented by numbers as shown below.
syntax:
$ chmod options permissions file name
$ chmod [OPTION]... MODE[,MODE]... FILE...
$ chmod [OPTION]... OCTAL-MODE FILE...
$ chmod [OPTION]... --reference=RFILE FILE…
Ans: Chown command: The command “chown” stands for change file owner and Group. This command is used to change the ownership of one or more files or folders for a specified user or group.
syntax:
$ chown [OPTION]… [OWNER][:[GROUP]] FILE…
Or
$ chown [OPTION]… –reference=RFILE FILE…
Ans: cp command: cp command is used to copy files and directories. It is also used to backup files or directories.
Syntax:
$ cp filename
Ans: rm command: The rm command is used to remove the directory or file specified on the command line. You need to be careful while removing any file or directory.
Syntax:
rm filename---
Command
|
Description
|
rm filename
|
Removes single file.
|
rm filename1, filename2, filename 3
|
Removes multiple files.
|
rm * .pdf
|
Removes all pdf files in the current directory.
|
rm -i filename(s)
|
-i mean to confirm before deleting the file
|
rm -f filename(s)
|
Removes files without prompting
|
rm -fv *.txt
|
Remove all .txt files in the current directory without prompting
|
Ans: mkdir, command allows users to create directories in Linux. Users can create multiple directories at once and can set the permissions to the directories.
Syntax:
mkdir [options...] [directories ...]
Option
|
Description
|
Directory
|
name of the directory to be created
|
-m=mode, --mode=mode
|
to set a file mode (permissions, etc.) for the created directories
|
-p, --parents
|
create parent directories
|
--v, --verbose
|
Verbose output. Print a message for the created directory.
|
--Z= context, --context=context
|
If you are using SELinux, this option sets the security context of each created directory to context.
|
--help
|
shows help message and exit
|
--version
|
It shows version information and exit
|
Ans: The rmdir is used to remove each directory specified on the command line.
Syntax:
rmdir [-p] [-v | –verbose] [–ignore-fail-on-non-empty] directories
Ans: We can use two commands to exit from the vi editor. They are
Ans: The following commands are used to delete information from a file in vi editors.
Ans: File content commands
Ans: We have so many Linux Distributors, among them, we discuss a few important ones.
Ans: We are many reasons, in that few important reasons are listed out. Following are
Ans: Following are the features of the Linux Operating System
Ans: Difference between Bash and Dos
Bash
|
Dos
|
Commands are case sensitive
|
commands are not case sensitive
|
Backward slash(/) represents directories separator
|
‘/’ represents command arguments
|
Forward slash ‘’ represents escape character
|
‘’ represents directories separator
|
Does not follow conventions naming in files
|
Follow naming convention in files
|
Ans:
Ans: It is a form of redirection that is used in Linux, it is used to combine 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
Ans: The parent process communicates with the child process by using pipes, sockets, messages queues, and more.
Ans: It is a centralized server that does not have any exists states on the working station. It may have scenarios when a state of a particular system takes a snapshot then, the user wants all other machines to be in that particular state.
Ans: Features of Stateless Linux Server
Ans: It is a process whose execution is completed but even the information exists in the process table. It occurs for the child process because the parent process needs to read the child process status. Once it is completed using the wait system call, then the zombie process is removed from the process table. This is known as Zombie Process.
Ans: In Linux, the Ctrl+Alt+Del key is used to restart the computer, and it does not display any confirmation message before rebooting the system.
Visit here to learn Linux Online Course in Bangalore |
Ans: Linux is an open-source operating system, nowadays it is rapidly growing in the technology market. We have a few reasons why Linux is more secure than other OS.
Ans: The tail command displays the last part of a file. Generally, users don't need every logline to troubleshoot. Instead, you want to check what your logs say about the most recent request to your application.
tail Example:
$ tail -n 100 /var/log/httpd/access_log
Ans: In Linux cat command concatenates and prints files. Users might issue cat to check the contents of your dependencies file or to confirm the version of the application that you have already built locally.
cat Example:
$ cat requirements.txt
flask
flask_pymongo
Ans: grep searches file patterns. If you are looking for a specific pattern in the output of another command, grep highlights the relevant lines. Use this grep command for searching log files, specific processes, and more.
grep Example:
$ cat tomcat.log | grep org.apache.catalina.startup.Catalina.start
12-Jan-2018 17:08:35.542 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 681 ms
Ans: ps command displays process status. Use this ps command to determine a running application or confirm an expected process.
ps Command Example:
$ ps -ef
$ ps -ef | grep tomcat
Ans: env command allows users to set or print the environment variables. During troubleshooting, users can find it useful for checking if the wrong environment variable prevents your application from starting.
env Command Example:
$ env
PYTHON_PIP_VERSION=9.0.1
HOME=/root
DB_NAME=test
PATH=/usr/local/bin:/usr/local/sbin
LANG=C.UTF-8
PYTHON_VERSION=3.4.6
PWD=/
DB_URI=mongodb://database:27017/test
Ans: top command displays and updates sorted process information. Use this top command to determine which processes are running and how much memory and CPU they are consuming.
Ans: netstat command in Linux shows the network status. This netstat command shows network ports in use and their incoming connections.
Ans: ls of command lists the open files associated with your application.
Ans: Users can use the df command to troubleshoot disk space issues. Here df stands for display free disk space.
df Command Example:
df -h
Ans: du command in Linux is used to retrieve more detailed information about which files use the disk space in a directory.
du Command Example:
$ du -sh /var/log/*
1.8M /var/log/anaconda
384K /var/log/audit
4.0K /var/log/boot.log
0 /var/log/chrony
4.0K /var/log/cron
4.0K /var/log/maillog
64K /var/log/messages
Ans: iptables command blocks or allows traffic on a Linux host, similar to a network firewall. This iptables command may prevent certain applications from receiving or transmitting requests.
Ans:
Linux | Windows |
Linux is available for FREE | It is paid software |
It is an Open-Source operating system | It is not an open-source OS |
Linux customization is possible | No customizations are available |
It provides high-level security | Can't defend virus and malware attacks unless until it is paid |
Primary partitioning and logical partitioning available to boot | Booting available while primary partitioning only |
BackSlash separates directories | The forward slash separates directories |
File names are case particular | Irrespective of the case while naming files |
Ans: cd- command go to the previous directory.
Ans: Go to $HOME directory
Ans: cd dir && command go to the dir, executes the command and returns to the current directory.
Ans: pushd command put current dir on the stack so you can pop back to it.
Ans: ls - ISr command shows files by size, biggest file will be displayed last.
Ans: This command shows top disk users in the current dir.
Ans: This command sort path by easy to interpret disk usage.
Ans: This command shows free space on mounted file systems.
Ans: df -I command shows free inodes on mounted filesystems.
Ans: fdisk -I command show disks partitions sizes and types (run as root).
Ans: Use this command to kills the program using one port: sudo fuser -k 8000/tcp
Ans:
ulimit -Sv 1000 # 1000 KBs = 1 MB
ulimit -Sv unlimited # Remove limit
Ans: Use this command: readlink -f file.txt
Ans: Use these commands:
tar tf file.tgz
tar xf file.tgz filename
Ans: Use this command to find who logged in: w
Ans: It is useful to detect permissions errors, for example when configuring a web server.
namei -l /path/to/file.txt
Ans: Use this command to do:
while inotifywait -e close_write document.tex
do
make
done
Ans: Use this command: cat file.txt | xclip -selection clipboard
Ans: Use this command to check resource usage: /usr/bin/time -v ls
Ans: Use this command: timeout 10s ./script.sh
# Restart every 30 minutes
while true; do timeout 30m ./script.sh; done
Ans: Use this command: comm file1 file2.
Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!
Name | Dates | |
---|---|---|
Linux Training | Sep 26 to Oct 11 | View Details |
Linux Training | Sep 30 to Oct 15 | View Details |
Linux Training | Oct 03 to Oct 18 | View Details |
Linux Training | Oct 07 to Oct 22 | View Details |
Usha Sri Mendi is a Senior Content writer with more than three years of experience in writing for Mindmajix on various IT platforms such as Tableau, Linux, and Cloud Computing. She spends her precious time on researching various technologies, and startups. Reach out to her via LinkedIn and Twitter.
1 / 9
Copyright © 2013 - 2023 MindMajix Technologies