Linux Interview Questions and Answers
A genuinely free and open source operating system, Linux is one of the most liked operating systems. It was designed keeping in mind the Unix compatibility. Read our detailed Linux interview questions to know more about the features and commands of Linux. Usually, it is called as the clone of Unix. Linux was developed by Linus Torvalds. While working on the Unix OS, he felt the need to improve Unix, but the designers of Unix rejected his suggestions. Hence, he founded the Linux in 1991 as a kernel first, which was later launched as a full-fledged OS.
Most Frequently Asked Linux Interview Questions
S.no | CRON | ANACRON |
---|---|---|
1. | It is a daemon that runs scheduled tasks | It runs commands periodically, the frequency being defined in several days. |
2. | Example – updates, system backups | Example – a backup script that is scheduled to run weekly or monthly. |
3. | Suitable for machines that are on 24x7 like servers | Suitable for machines like laptops and desktops that are NOT on 24x7. |
4. | Runs as per defined schedules. | Checks if any job has to be executed when the user turns on the power. |
5. | Default system crontab file is /etc/crontab | Listed in /etc/anacrontab |
A program that gets executed in the background because of the occurrence of a specific event, process or condition. Daemon processes are managed by the Kernel. The operations are given unique PIDs.
1. | ext2 | Second extended filesystem. |
2. | ext3 | The concept of journaling was introduced, wherein, if a system crash or power failure occurred, the filesystems that were not saved could be recovered, unlike ext2. |
3. | ext4 | Performance improvements over the ext3 filesystem. Supports huge filesizes. |
- Ifconfig – configure interface parameters of the network.
- dig – performs DNS lookups to display a result obtained from name servers.
- traceroute – prints the route that the packets take to the network host.
- nslookup – queries internet domain name servers.
- telnet – connect destination port if the connection between hosts is working fine
- netstat – reviews each network connection and the open sockets.
- w – writes (prints) current activities and processes by each user.
- scp – secure copy the files from and to another host in the network.
- ifup/ifdown – enable or disable the network interface respectively.
- nmap – checks for the opened port on the server
Use chmod 777 to give full permission to reading, write and execute.
There are three modes – command mode, insert mode and last line or escape mode.
Use the command apt-get as –
apt-get --purge remove [filename]
There are 80 system calls in Unix that are used to control processes, manage filesystem and for inter-process communication. System calls occur in the kernel.
For this access the individual command’s manual page. For instance, to know the description of
cat command, type
man cat
This will display a description of the said command.
There are 7 types of network bond in Linux – mode=0 (balance-rr), mode-1 (active-backup),
mode=2 (balance-xor), mode=3 (broadcast), mode=4 (802.3ad), mode=5 (balance-tlb),
mode=6 (balance-alb)
There are 3 main components in Linux
- Kernel, which communicates with the users and the underlying hardware;
- System library, which is a collection of functions and programs that contain almost all the functionalities of an operating system. Users can access the kernel’s features using these library functions;
- System utility, which is a set of programs that do individual, specialized tasks
Check out all the Linux interview questions to understand how Linux is a more improved version of Unix.
Advantages of Linux
- Linux is open source. Hence there are several distributions available to the end user. Example – Ubuntu, Mint.
- By making the code available to everyone, security issues are caught by experts before the versions are released to the public, hence offering higher security.
- Linux can be installed on any hardware without any hassle.
- Highly customizable and flexible because of the availability of source code.
- Provides good networking support using many commands. (Read more about this in our set of Linux interview questions)
- Has good support and documentation.
Latest version
The latest version of Linux is Debian 9.3 released on December 9, 2017.