Linux Interview Questions
100 Interview Questions for Freshers 1 -2 Experienced Candidates

Linux Interview Questions
1. What is Linux
Linux is an operating system, which is based on the 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.
2. Who invented Linux? Explain the history of Linux?
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.
3. What is Linux Kernel?
Linux kernel is the heart of the operating system. It acts as a bridge between software and hardware. If Software requests the hardware, the kernel delivers the data between the software and hardware.
For example, if you want to play a song you should launch your default player, it requests the kernel to play music, and 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.
4. What is BASH?
BASH (Bourne Again Shell) is basically a command language interpreter. It was written by Brian Fox for GNU OS and can be used in place of Bourne Shell.
It is similar to Bourne Shell but includes some additional features such as command-line editing that make it easier and more convenient to use. It is the default user shell on most Linux installations.
It is basically an interpreted and non-compiled process that can also run in the terminal window. It is also capable of reading commands from shell scripts.
5. 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.
Learn Linux From Our Expert Trainer
6. 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 allow the user to manage the computer.
- Application Programs: Software programs or set of functions designed to accomplish a specific task.
7. 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
8. What is Swap Space?
Swap Space is the additional space 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.
9. What are two types of Linux User Mode?
There are two types of Linux user mode as given below:
- Command Line
- GUI
10. What is the maximum length for a filename under Linux?
The maximum length for a filename under Linux is 255 bytes.
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer
11. Name the Linux that is specially designed by Sun micro system.
Linux that is specially designed by Sun micro system is Solaris.
12. Under the Linux system, what is the typical size for swap partitions?
The typical size for a swap partition under a Linux system should be twice the amount of physical memory or RAM available on the system.
13. What are file permissions in Linux? Name different types of file systems in Linux.
There are three owners in the Linux System i.e., user, group, and others. These owners have three types of permissions defined as listed below:
- Read (r): It allows the user to open and read the file or list the directory.
- Write (w): It allows the user to open and modify the file. One can also add new files to the directory.
- Execute (x): It allows the user to execute or run the file. One can also lookup a specific file within a directory.
14. Name the file that is used to automatically mount file systems.
File that is used to automatically mount file systems is a Fstab file.
15. What is LVM and why is it required?
LVM (Logical Volume Management) is a tool that provides logical volume management for the Linux kernel.
It is being introduced to make physical storage device management more effortless. It also includes allocating disks, striping, mirroring, and resizing logical volumes.
Its main advantages are increased abstraction, flexibility, and control. It simply allows for flexible disk space management. It is especially required to resize the size of the file system online.
In Linux, the size of the LVM partition can be extended using the “lvextend” command and can be reduced using the “reduce” commands, respectively
Learn Linux From Our Expert Trainer
16. What is the advantage of Open Source?
Linux was one of the first open-source technologies, many programmers added software that is 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.
17. What is the disadvantage of Open Source?
Disadvantages of Open Source Operating System mentioned below
- Difficulty of use
- Compatibility Issues
- Liabilities and warranties
- Hidden costs
18. What are the environmental variables?
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 behavior.
19. What are the symbolic links?
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.
20. What are the hard links?
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.
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer
21. What is redirection?
Redirection can be defined as changing the standard input and output devices. To redirect metacharacters are used, you can redirect the file or program.
22. What are Daemons?
A Daemons is a background process that accepts the requests for service from other computers, most of the operating systems use daemons in other forms.
23. What is load average in Linux?
Load average, as the name suggests, is the average system load on Linux servers being calculated over a given period of time. The load average of Linux servers can be found using “top” and “uptime” commands.
It is simply used to keep track of system resources. It is represented by a decimal number starting at 0.00. It tells you the load that the system has been under.
24. What do you mean by Shell Script?
Shell Script, as the name suggests, is a script especially written for shell. Here, script means programming language that is being used to control applications. It simply allows the execution of different commands that are entered in the shell.
It generally helps you to create complex programs containing conditional statements, loops, and functions. It is very easy to debug, can simplify everyday automation processes, and is much quicker as compared to writing big programs.
25. What is INODE and Process Id?
INODE: It is a unique name given to each file by OS. Each inode has a unique inode number within a file system. It stores various information about files in Linux such as ownership, file size, file type, access mode, number of links, etc.
Process Id (Identifier): It is a unique Id given to each process. It is simply used to uniquely identify an active process throughout the system until the process terminates.
Learn Linux From Our Expert Trainer
26. Name the first process that is started by the kernel in Linux and what is its process id?
The first process started by the kernel in Linux is “init” and its process id is 1.
27. What is CLI and GUI?
CLI (Command Line Interface): It is a command-line program that usually accepts text as input to execute or run operating system functions.
It allows users to type declarative commands to give instructions to the computer to perform or execute operations.
It usually requires less memory to use as compared to other interfaces as well as it does not need Windows and a low-resolution monitor can be used.
It usually provides greater flexibility of use and can also be used to perform things easily that are most difficult to do with GUI.
GUI (Graphical User Interface): It is a human-computer interface that allows users to interact with electronic devices through graphical icons and visual indicators.
The use of these graphical elements or icons makes it easier for users to interact with the system. It is visually intuitive and allows higher productivity. It is usually a combination of graphical and textual interaction that uses menus, buttons, message boxes, etc.
28. Explain Process Management System Calls in Linux?
The process management system calls in Linux:
- fork(): Used to create a new process.
- exec(): Execute new process.
- wait(): wait until process execution.
- exit(): exit from the process.
System calls to get the Process id :
- getpid(): to find the unique process id.
- getppid(): to find the unique parent process id.
29. Explain File Permission groups in Linux?
There are three user-based permission groups for each file and directory.
They are:
- Owner: Owners only will have to access the file or directory, they will not impact the actions of other users.
- Group: These permissions apply only to the group that has been assigned to the file or directory. They will not impact the actions of other users.
- All Users: These permissions are applied to all users on the system.
30. What Is a File System in Linux?
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.
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer
31. Explain different file system types in Linux?
In Linux, there are many file systems:
Ext, Ext2, Ext3, Ext4, JFS, XFS, btrfs, ufs, autofs, devpts, ntfs and swap.
32. Write the difference between Soft and Hard links?
Hard Links: It is a special file that points to the same underlying inode as another file. It can be referred to as an additional name for an existing file on Linux OS.
The total number of hard links for a file can be displayed using the “ls -l” command. Such links cannot be used across file systems. Hard links can be created using the following command:
$ ln [original filename] [link name]
Soft Links: It is also termed a Symbolic Link. Soft links are kinds of files that usually point to another file. It does not include any amount of data in the target file and points to another entry anywhere in the file system.
Such links can be used across file systems. Soft links can be created using the following command:
$ ln -s [original filename] [link name]
33. What is the netstat command?
netstat (Network statics) command is generally a networking tool being used for troubleshooting and configuration and used to display all network connections on a system.
It simply provides a way to check whether various aspects of TCP/IP are working and what connections are present.
34. What is the ping command?
Linux ping (Packet Internet Groper) command is a command that is used to check connection status between source and destination. In simple words, this command is used to check whether a network is available and if the host is reachable.
It can also be used to troubleshoot different connectivity issues, verify connectivity at an IP -level to a second TCP/IP device, and name resolution. One can use this command to test both the computer name and IP address of the computer.
35. Which command is used to check the default run level?
The command used to check the default run level is “/etc/inittab”.
Learn Linux From Our Expert Trainer
36. Which command is used to check the size of a file or directory?
The command used to check the size of the file or directory is “du”. Here “du” stands for disk usage that is used to check information of disk usage of files and directories on a machine. It is also used to display files and directory sizes in a recursive manner.
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
37. Which command is used to count the number of characters in a file?
The command that is used to count the number of characters in a file in Linux is “wc”. Here “wc” stands for word count. It is used to count the number of lines, words, and characters in a text file.
38. What is the function of grep command?
Grep (Global regular expression print) is a command that is used for the global search for a string of characters in a specified file. The text search pattern is generally known as a regular expression. It simply makes use of pattern-based searching.
Syntax: grep [options] pattern [files]
Example: $ grep -c “linux” interview.txt
The above command will usually print the total count of the word “Linux” in the file “interview.txt”.
39. Explain working of env commands.
“env” command is basically a shell command that is used to print a list of current environmental variables. Here, “env” stands for the environment. It can also run another process in another environment without any modification of the current environment.
It allows you to run programs in a modified environment. It is generally used by shell scripts to launch the correct interpreter. It can also be useful for checking if wrong environment variables prevent the application from starting during troubleshooting.
Example:
$env
PHYTHON_PIP_VERSION=9.0L1
HOME=/root
DB_NAME=test
PATH=/usr/local/bin:/usr/local/sbin
LAND=C.UTF=8
PYTHON_VERSION=3.4.6
PWD=/
DB_URI=mongodb://database:27017/test
40. What is the pwd command?
“pwd” command is basically a command that is used to print the complete path of the current working directory starting from the root (/).
Here, “pwd” stands for Print Working Directory. It is considered one of the most basic and most used commands in Linux. This command is usually a built-in shell command and is also available in different shells such as bash, ksh, zsh, bourne shell, etc.
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer
41. Name the command that is used to check all the listening ports and services of your machine.
# netstat -ntlp
42. Which command is used to check the memory status?
The command used mostly to check memory status in Linux is “free”. Other commands that can be used are given below:
- “cat” command: It can be used to show or display Linux memory information. (cat/proc/meminfo)
- “vmstat” command: It can be used to report statistics of virtual memory.
- “top” command: It can be used to check the usage of memory.
- “htop” command: It can be used to find the memory load of each process.
43. What is a pipe?
In Linux, a pipe is basically a form of redirection that is used to send the output of one command to another command for further processing.
It simply takes the output from one command and uses it as an input for another. It provides asynchronous execution of commands with help of buffered I/O routines.
44. What are Linux directory commands?
There are basically five Linux directory commands that are used to work with files and directories as given below:
- pwd: It stands for “print working directory”. This command is generally used to display the path of the present or current working directory.
Syntax: $ pwd - cd: It stands for “change directory”. This command is generally used to change the present working directory to the directory that we want to work on.
Syntax: $ cd <path to new directory> - Is: It stands for “list”. This command is generally used to show the full list of content of files and directories in the present working directory.
Syntax: $ ls - mkdir: It stands for “make directory”. This command generally allows users to create directories in Linux.
Syntax: $ mkdir <name (and path if required) of new directory>
rmdir: It stands for “remove directory”. This command is used to remove/delete each directory that is specified on the command line.
Syntax: $ rmdir <name (and path if required) of directory>
45. What do you mean by unmask?
Umask, also known as user file-creation mask, is a Linux command that allows you to set up default permissions for new files and folders that you create.
In Linux OS, umask command is used to set default file and folder permission. It is also used by other commands in Linux like mkdir, tee, touch, etc. that create files and directories.
Syntax: umask [-p] [-S] [mask]
Where,
[mask]: It represents the permission masks that you are applying.
[-S]: It displays the current mask as a symbolic value.
[-p]: It displays the current mask along with the umask command thus allowing it to be copied and pasted as a future input.
Learn Linux From Our Expert Trainer
46. Name the command used to review boot messages.
The command that is used to review boot messages is the “dmesg” command.
47. Why is LVM required?
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.
48. What is umask?
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]
49. How to set the umask permanently for a user?
If the umask command is invoked without any arguments, it means it will display the current mask.
To set the umask permanently, we have two types.
They are:
- Ocotal representation.
- Symbolic representation.
50. What is network bonding in Linux?
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 behavior of the bonded interface depends on the bonding method.
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer



51. What are the different modes of Network bonding in Linux?
Different modes of Linux network bonding
- Mode-0(balance-rr): It is a default mode and based on Round-Robin policy. It offers fault tolerance and load balancing features. It used round-robin fashion to transmit the packets.
- Mode-1(active-backup): It is based on Active Backup policy and only one slave will act in the band and another one will act when the others fail in the band. It also provides fault tolerance.
- Mode-2(balance-xor): It sets a xor mode between the source Mac address and destination Mac address to provide fault tolerance.
- Mode-3(broadcast): It is based on broadcast policy and transmitted everything in the slave interface. It also provides fault tolerance and can be used only for a particular purpose.
- Mode-4(802.3ad): It is a dynamic aggregation mode, it creates aggregation groups which are having the same speed. It uses the transmit hashing method to select the slaves for outgoing traffic.
- Mode-5(balance-tlb): The outgoing traffic is according to the current load on the slave, and the incoming traffic is received by the slave. It is called an adaptive transmit load balancing mode.
- Mode-6(balance-alb): It is an adaptive load balancing mode. It does not require any switch support.
52. How to check the default route and routing table?
To display the default route and routing table, we use the following commands.
$ route-n
$ netstat-rn
$ ip
53. How to check which ports are listening on my Linux Server?
We have two commands to check which ports are listening in Linux Server. Following are the two commands
# netstat –listen
# netstat -l
54. Where the kernel modules are located?
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.
55. How to change the default run level in Linux?
To change the default run level in Linux use the init command.
Learn Linux From Our Expert Trainer
56. How to share a directory using NFS?
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.
57. What is a Latch?
A Latch is a temporary storage device controlled by a timing signal which can either store 0 or 1. A Latch has two stable states (high-output or 1, and low-output or 0) and is mainly used to store state information.
A Latch can store one bit of data as long as it is powered on.
58. What is a Microprocessor?
A Microprocessor is a device that executes instructions. It is a single-chip device that fetches the instruction from the memory, decodes it and executes it. A Microprocessor can carry out 3 basic functions:
- Mathematical operations like addition, subtraction, multiplication, and division
- Move data from one memory location to another
- Make decisions based on conditions and jump to new different instructions based on the decision.
59. How to copy a file in Linux?
You can use the cp command to copy a file in Linux. The general syntax is:
$ cp <source> <destination>
Suppose you want to copy a file named questions.txt from the directory /new/linux to /linux/interview, then the command will be:
$ cp questions.txt /new/linux /linux/interview
60. How to terminate a running process in Linux?
Every process has a unique process id. To terminate the process, we first need to find the process id. The ps command will list all the running processes along with the process id. And then we use the kill command to terminate the process.
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer
61. Enlist some Linux distributors (Distros) along with their usage?
We have so many Linux Distributors, among them, we discuss a few important ones.
- Linux Mint: It is stable and robust. Linux Mint uses mate desktop and cinnamon.
- Debian: It stands for robustness, stability, and a well-oiled release cycle. It is user-friendly. Debian version 8 will be replaced by version 9.
- Ubuntu: It is available for both desktop and server editions and is based on Debian.
- openSUSE: It is a good choice for new users and existing users.
- Manjaro: It gives a pleasant experience for new and experienced users.
62. Why do we use LINUX?
We have many reasons, in that few important reasons are listed out. Following are
- High Stability: It is very stable and does not lead to crashes, it runs fastly as it was when it was first installed.
- Security: It is a dependable server that offers high security to the user. Using Linux on your system it is easy to avoid viruses and malware. The attacker cannot change any changes in the system until the user logged in as the root user.
- Easy to Operate: Linux is easy to operate and we can install it easily onto the system because all the variants of Linux have their own software repositories. You can update the system periodically with just a few clicks or you can set automatic updation.
- Hardware Compatibility: Linux can be used on any hardware, it doesn’t have any hardware restrictions. It uses all system resources efficiently.
- Open Source: The source code is available as it is under Free and Open Source Software(FOSS).
63. What is meant by PIPE in Linux?
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
64. Describe how a parent and child process communicates with each other?
The parent process communicates with the child process by using pipes, sockets, messages queues, and more.
65. What is a Stateless Linux Server?
It is a centralized server that does not have any existing 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.
Learn Linux From Our Expert Trainer
66. Explain the features of Stateless Linux Server?
Features of Stateless Linux Server
- Stores the prototype of every system.
- Stores the snapshot was taken.
- Stores the home directories.
- Uses LDAP, which contains the information about which snapshot should run on which system.
67. What is the Zombie Process?
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 the Zombie Process.
68. Explain the work of the Ctrl+Alt+Del key combination on the Linux operating system?
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.
69. What is the tail command in Linux?
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
70. What is the cat command in Linux?
In Linux cat command concatenates and prints files. Users might issue a 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
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer
71. What is the grep command in Linux?
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
72. What is the ps command in Linux?
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
73. What is the env command in Linux?
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
74. What is the top Command in Linux?
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.
75. What is the netstat command in Linux?
netstat command in Linux shows the network status. This netstat command shows network ports in use and their incoming connections.
Learn Linux From Our Expert Trainer
76. What is the lsof command in Linux?
netstat command in Linux shows the network status. This netstat command shows network ports in use and their incoming connections.
77. What is the df command in Linux?
Users can use the df command to troubleshoot disk space issues. Here df stands for display free disk space.
df Command Example:
df -h
78. What is a du command in Linux?
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
79. What is the iptables command in Linux?
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.
80. How do you check if a particular service is running?
$ service <servicename> status
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer
81. How do you check the status of all the services?
$ service –status-all
82. How do you start and stop a service?
To start:
$ service <servicename> start
To stop:
$ service <servicename> start
83. Explain the free command.
This command is used to display the free, used, swap memory available in the system.
Typical free command output. The output is displayed in bytes.
$ free
84. How do you sort the entries in a text file in ascending order?
This can be done using the sort command.
$ sort sample.txt
85. What does the cd - command do?
cd- command go to the previous directory.
Learn Linux From Our Expert Trainer
86. What does cd command do?
Go to $HOME directory
87. What does (cd dir && command) do?
cd dir && command go to the dir, executes the command and returns to the current directory.
88. What does pushd command do?
pushd command put current dir on the stack so you can pop back to it.
89. What is the ls -lSr command?
ls – ISr command shows files by size, biggest file will be displayed last.
90. What is du -s * | sort -k1,1rn | head command used for?
This command shows top disk users in the current dir.
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Learn Linux From Our Expert Trainer
91. How do you kill the program using one port in Linux?
Use this command to kills the program using one port: sudo fuser -k 8000/tcp
92. How do you limit memory usage for commands?
- ulimit -Sv 1000 # 1000 KBs = 1 MB
- ulimit -S unlimited # Remove limit
93. How do you get the full path of a file in Linux?
Use this command: readlink -f file.txt
94. How do you list the contents of tar.gz and extract only one file?
Use these commands:
- tar tf file.tgz
- tar xf file.tgz filename
95. How do you find who is logged in?
Use this command to find who logged in: w
Learn Linux From Our Expert Trainer
96. How do you check the permissions of each directory to a file?
It is useful to detect permissions errors, for example when configuring a web server.
namei -l /path/to/file.txt
97. What is df -h command?
This command shows free space on mounted file systems.
98. What is df -i command?
df -I command shows free inodes on mounted filesystems
99. What is the fdisk -l command used for?
fdisk -I command shows disk partition sizes and types (run as root).
100. How do you combine two lines from two sorted files in Linux?
Use this command: comm file1 file2.
Want to download these Linux Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version