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.
If you have attended any interviews earlier, and haven't found the same questions you have faced, then comment on those questions in the comment section, and we will add them to this blog.
Want to Enrich your Career Potential as a Linux Developer then Enrol into our Linux Certification Course .
Below mentioned are the most frequently asked Linux interview questions. Let's have a look into them
Linux Interview Questions - Frequently Asked [Updated-2021]
Linux Interview Questions for Beginners
Linux Basic Interview Questions
1. What is Linux?
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.
2. Who invented Linux? Explain the history of Linux?
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.
3. What is the difference between Linux and Unix?
Ans. Linux vs 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.
- Linux Is Just Kernal
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 as a complete OS as everything come from a single vendor.
- Security And Firewall
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 comes with its own firewall products.
- Backup And Recovery
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.
4. What is the core of the Linux operating system?
Ans: Kernel is the core of the Linux operating system.
--------Also Read History of Linux OS --------
5. What is the Linux Kernel?
Ans: 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.
For more detailed information about Kernel: Read more at Linux Kernel Tutorial
6. What is BASH?
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.
7. What is LILO?
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.
8. What is CLI?
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.
9. What is the advantage of Open Source?
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.
10. What is the disadvantage of Open Source?
Ans: Disadvantages of Open Source Operating System mentioned below
- Difficulty of use
- Compatibility Issues
- Liabilities and warranties
- Hidden costs
11. What is Shell?
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 the kernel understandable language.
12. How many types of Shells are there in Linux?
Ans: They are five Shells in Linux:
- C Shell (csh): It is like C syntax and provides spelling checking and job control.
- Korn Shell (ksh): This is a high-level programming language shell.
- Z Shell (Zsh): It provides some unique nature like it observes login/logout watching, file name generating, startup files, closing comments.
- Bourne Again Shell (bash): It is the default to Linux distributions.
- Friendly Interactive Shell (Fish): It provides web-based configuration, auto-suggestions, etc.
Related Article - Linux Network Monitoring Tools
13. What are the basic components of Linux?
Ans: Basic components of Linux
- Kernel: It is the core component of Linux, it acts as an interface between software and hardware.
- Shell: It acts as an interface between the user and the Kernel.
- GUI: It stands for Graphic User Interface, which is another way for the user to interact with the system. But it is unlike images, buttons, text boxes for interaction.
- System Utilities: These are the software functions that allow users to manage the computer.
- Application Programs: Set of functions designed to perform a set of tasks.
14. How do you open a command prompt when issuing a command?
Ans: Launch your terminal by pressing CTRL+ALT+T or by giving terminal in the menu search bar.
15. What is a swap space?
Ans: Swap Space is used when then 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.
16. What is the GUI?
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.
17. Explain File Permissions types in Linux?
Ans: Each file or directory has 3 permissions
- Read-- It refers to that only they can read the file.
- Write-- It refers that they can write the file or modify the file of a directory.
- Execute-- It affects the user’s capability to execute the file or to view the file of a directory.
Read more at - Linux File Permissions
18. What are the environmental variables?
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 behaviour.
20. What are the symbolic links?
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.
21. What are the hard links?
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.
22. What is redirection?
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.
23. What are Daemons?
Ans: 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.
24. Describe the root account?
Ans: Root is the user name, that default has access to all files and commands. The root user can do many things, but an ordinary user cannot do like installing software, change file permissions, etc.
25. Explain the virtual desktop?
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.
26. What are the different modes when using the v editor?
Ans: There are three kinds of modes in vi editors. They are
- Command Mode/ Regular Mode
- Insertion Mode/Edit Mode.
- Ex Mode/ Replacement Mode.
27. What are inode and process id?
Ans: inode is a unique name given to each file and process id is a unique name given to each process.
28. What are the Process states in Linux?
Ans: Five process states in Linux. They are
- New/ Ready: A new process is created and ready to run.
- Running: The process is being executed.
- Blocked/ Wait: The process is waiting for input from the user.
- Terminated/ Completed: The process completed the execution or terminated by the operating system.
- Zombie: The process is deleted, but still the information regarding the process exists in the process table.
29. Explain Process Management System Calls in Linux?
Ans: 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.
30. Explain File Permission groups in Linux?
Ans: There are three user based permission groups for each file and directory.
- 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.
31. What Is a File system in Linux?
Subscribe to our youtube channel to get new updates..!
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.
32. Explain different file system types in Linux?
Ans: In Linux, there are many file systems:
Ext, Ext2, Ext3, Ext4, JFS, XFS, btrfs, ufs, autofs, devpts, ntfs and swap.
Linux Admin Interview Questions
32. Why LVM is required?
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.
33. What is umask?
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]
34. How to set the mask permanently for a user?
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.
- Ocotal representation.
- Symbolic representation.
35. What is network bonding in Linux?
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.
36. What are the different modes of Network bonding in Linux?
- 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 created aggregation groups which is 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.
37. How to check the default route and routing table?
Ans: To display the default route and routing table, we use the following commands.
$ route-n $ nestat-rn $ ip
38. How to check which ports are listening in my Linux Server?
Ans: We have two commands to check which ports are in listening in Linux Server. Following are the two commands
# netstat --listen # netstat -l
39. Where the kernel modules are located?
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.
40. How to change the default run level in Linux?
Ans: To change the default run level in Linux use the init command.
41. How to share a directory using NFS?
Ans: To share a directory using NFS, first edit the configuration file and ‘/etc/exports’ and add an entry like directory name ‘/
42. What are the default ports used for SMTP, DNS, FTP, DHCP, SSH, and squid?
Ans. Details mentioned below
|FTP||20(Data Transfer) 21(Connections Established)|
|DHCP||68(dhcp client), 67(DHCP server)|
43.How to lock a user account in Linux?
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.
- Lock or disable the password using passwd command.
- Expire the user account using usermod command or chage command.
- Changing the shell using nologin command ( /sbin/nologin ).
Linux Commands Interview Questions
44. What is the ls command and what it does?
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
<span style="color: #ecf0f1; background-color: #000000;">ls [OPTIONS] [FILES]</span>
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.
<span style="background-color: #000000; color: #ecf0f1;">Is</span>
To list the specific directory files use the directory name in the syntax, follow as shown in the below syntax.
We can also pass multiple directories names in the syntax, but separated by space.
ls /etc /var /etc/passwd
45. What is the tail command in Linux?
Ans: The Tail command print the last N number of lines of the given data, it prints 10 lines by default.
tail [OPTION]... [FILE]
$ cat names.txt
Tableau<br>sql server<br>linux administration<br>Now, check the syntax without giving any option or input.
$ tail state.txt
<span style="font-family: 'courier new', courier, monospace;"><span style="color: #222222; font-family: Verdana;"><span style="white-space: pre-wrap;"><strong><em>Output:</em></strong><br></span></span></span>Tableau<br>sql server<br>linux administration<span style="font-family: 'courier new', courier, monospace;"><span style="color: #222222; font-family: Verdana;"><span style="white-space: pre-wrap;"><br></span></span></span>
46. What is grep command in Linux?
Ans: grep command is a filter that is used to the global search for regular expressions.
grep [options] pattern [files]
47. What is ps command in Linux?
Ans: ps command display the current process status of the system. And it displays the process id’s with some other related data also.
[root@rhe17~]# ps PID TTY TIME CMD 12330 pts/0 00:00:00 bash 21621 pts/0 00:00:00 ps
Also Read: Basic Linux Commands with Examples
48. What is the env command in Linux?
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]...]
|-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.|
49. What is the top Command in Linux?
Ans: top command used to show the system process and it displays and updates the sorted process information.
50. What is netstat command in Linux?
Ans: netstat command gives various information about the network and routing tables, interface statics and more about the system.
51. What is lsof command in Linux?
Ans: lsof means List of file, we can know which file is opened by which process.
52. Explain about chmod command?
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.
- 4 - read permission
- 2 - write permission
- 1- execute permission
$ chmod options permissions file name $ chmod [OPTION]... MODE[,MODE]... FILE... $ chmod [OPTION]... OCTAL-MODE FILE... $ chmod [OPTION]... --reference=RFILE FILE…
53. Explain about chown command?
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.
$ chown [OPTION]… [OWNER][:[GROUP]] FILE… Or $ chown [OPTION]… –reference=RFILE FILE…
54. What is cp command in Linux?
Ans: cp command: cp command is used to copy files and directories. It is also used to backup files or directories.
$ cp filename
55. How to remove a file or directory from the system in Linux?
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.
|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 means to confirm before deleting the file|
|rm -i filename(s)||Removes files without prompting|
|rm -fv *.txt||Remove all .txt files in the current directory without prompting|
56. What is mkdir in Linux?
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.
mkdir [options...] [directories ...]
|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|
57. Explain rmdir command in Linux?
Ans: The rmdir is used to remove each directory specified on the command line.
rmdir [-p] [-v | –verbose] [–ignore-fail-on-non-empty] directories
58. How to exit from vi editors?
Ans: We can use two commands to exit from the vi editor. They are
- Wq: wq command saves the current work and exits from the vi editor.
- q!: q! The command does not save the current work, but it exits from the vi editor.
59. How to delete information from a file in vi?
Ans: Following commands are used to delete information from a file in vi editors.
- Command x deletes the current character.
- Command dd deletes the current line.
60. Enlist some Linux file content commands?
Ans: File content commands
- head: Display top lines of the file.
- tail: Display last lines of the file.
- cat: Concatenate more than 2 files.
- more: Displays the content in pager form to view in the terminal.
Linux Technical Interview Questions and Answers for Experienced
61. Enlist some Linux distributors (Distros) along with its usage?
Ans: 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 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 we use LINUX?
Ans: We are some 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 is when it installed first.
- Security: It is a dependable server, that offers high security to the user. Using Linux on your system it is easy to avoid virus and malware. The attacker cannot change any changes in the system until the user logged in at as root user.
- Easy to Operate: Linux is easy to operate and we can install easily on to the system because all the variants of the Linux have there owned software repositories. You can update the system periodically with just a few clicks or you can set automatic updation.
- Hardware Compatibility: Linux can use on any hardware, it doesn’t have any hardware restrictions. It uses efficiently all system resources.
- Open Source: The source code is available as it is under Free and Open Source Software(FOSS).
63. What are the features of the Linux operating system?
Ans: Following are the features of the Linux Operating System
- Portable: Software can work on different types of hardware in the same way. It can carry easily in pen drives and memory cards.
- Open Source: Source code available for free, and its community-based development project.
- Multi-User: Multiple users can use ram, applications and run programs at the same time.
- Multiprogramming: Multiple program or applications can run at the same time.
- Shell: It has a special interpreter program where you can execute programs and commands of the system.
- Security: It provides authentication, authorization, and encryption to provide security to the data.
64. Differentiate between BASH and 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|
65. What is meant by internal commands and external commands?
- Internal Commands: Commands directly run by the shell are known as internal commands and there is no separate process to run the commands.
- External Commands: Commands which are run by the kernel are known as external commands and every single command has its own unique process id.
Linux Networking Interview Questions
66. What is meant by PIPE in Linux?
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.
command_1 | command_2 | command_3 | .... | command_N
67. Describe how a parent and child process communicates with each other?
Ans: The parent process communicates with the child process by using pipes, sockets, messages queues, and more.
68. What is a Stateless Linux Server?
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.
69. Explain the 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.
70. What is Zombie Process?
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.
71. Explain the work of the Ctrl+Alt+Del key combination on the Linux operating system?
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.
72. Why is Linux considered more secure than other operating systems?
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.
- The perk of accounts: Linux allows only a few users to access the system. Thus, the virus cannot attack the whole system, it may cause only a few files in the system.
- Strong Community: Linux users first accomplished the files before they open. So they can save their systems from vulnerabilities.
- Iptables: Iptables used by the Linux because it checks the security circle of the system.
- Different Working Environment: Linux system has different working environments like Linux Mint, Debian, Arch, and many more, these working environments protect from the virus.
- Recording in Linux: It maintains log history because later it can view the details of the system files easily.
- Few User: Linux users are less compared to others, due to this security will be more.
73. What is the tail command in Linux?
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 -n 100 /var/log/httpd/access_log
74. What is the cat command in Linux?
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 requirements.txt flask flask_pymongo
75. What is the grep command in Linux?
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.
$ 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
76. What is ps command in Linux?
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
77. What is the env command in Linux?
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
78. What is the top Command in Linux?
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.
79. What is the netstat command in Linux?
Ans: netstat command in Linux shows the network status. This netstat command shows network ports in use and their incoming connections.
80. What is the lsof command in Linux?
Ans: ls of command lists the open files associated with your application.
81. What is the df command in Linux?
Ans: Users can use the df command to troubleshoot disk space issues. Here df stands for display free disk space.
df Command Example:
82. What is a du command in Linux?
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
83. What is the iptables command in Linux?
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.
Linux Vs Windows
|Linux is available for free||Windows has to be bought|
|It is an open-source OS||It is not open-source OS|
|One can customize Linux||No customizations available|
|Provides high-level security||Cannot defend virus and malware attacks|
|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 case while naming files
84. What does the cd - command do?
Ans: cd- command go to the previous directory.
85. What does cd command do?
Ans: Go to $HOME directory
86. What does (cd dir && command) do?
Ans: cd dir && command goes to the dir, execute the command and return to the current directory.
88. What does pushd command do?
Ans: pushd command put current dir on the stack so you can pop back to it.
89. What is ls -lSr command?
Ans: 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?
Ans: This command shows top disk users in the current dir.
91. What does this du -hs /home/* | sort -k1,1h command do?
Ans: This command sort path by easy to interpret disk usage.
92. What is df -h command?
Ans: This command show free space on mounted file systems.
93. What is df -i command?
Ans: df -I command shows free inodes on mounted filesystems.
94. What is fdisk -l command used for?
Ans: fdisk -I command show disks partitions sizes and types (run as root).
95. How do you kill the program using one port in Linux?
Ans: Use this command to kills the program using one port: sudo fuser -k 8000/tcp
96. How do you limit memory usage for commands?
Ans: ulimit -Sv 1000 # 1000 KBs = 1 MB
ulimit -Sv unlimited # Remove limit
97. How do you get full path of a file in Linux?
<strong style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; color: #e74c3c;">Ans:</strong> Use this command: readlink -f file.txt
98. How do you list contents of tar.gz and extract only one file?
Ans: Use these commands:
- tar tf file.tgz
- tar xf file.tgz filename
99. How do you find who is logged in?
Ans: Use this command to find who logged in: w
100. How do you check permissions of each directory to a file?
Ans: It is useful to detect permissions errors, for example when configuring a web server.
namei -l /path/to/file.txt
101. How do you run the command every time a file is modified?
Ans: Use this command to do:
while inotifywait -e close_write document.tex do make done
102. How to copy text to the clipboard?
Ans: Use this command: cat file.txt | xclip -selection clipboard
103. How do you check resources usage?
Ans: Use this command to check resource usage: /usr/bin/time -v ls
104. How do you run a command for a limited time?
Ans: Use this command: timeout 10s ./script.sh
# Restart every 30 minutes
while true; do timeout 30m ./script.sh; done
105. How do you combine two lines from two sorted files in Linux?
Ans: Use this command: comm file1 file2.