Best 50 Basic Linux Interview Questions And Answers

1. What is Linux ? – (Basic Linux Interview Questions)_text]Answer:
Linux is a UNIX based operating system. It was first introduced by Linus Torvalds. It is an open source operating system that was designed to provide free and a low cost operating system for the computer users.

Basic Linux Interview Questions2. Is it legal to edit the Linux kernel ?_text]Answer:
Yes, as it is under General Public License (GPL) and anyone can edit.3. Is there any relation between modprobe.conf file and network devices ?_text]Answer:
Yes, this file assigns a kernel module to each network device.

For Example :-

[root@localhost ~]# cat /etc/modprobe.conf
alias eth0 b44
Here, b44 is the kernel module for network device eth0.
We can confirm whether this module “b44” is present or not by the following command
[root@localhost ~]# lsmod |grep b44
b44 29005 04. What is YUM ?_text]Answer:
YUM stands for Yellow dog Updater, Modified because it is based on YUP, the Yellow dog Updater.5. Where does the name Yellow dog come from ?_text]Answer:
Yellow Dog is a version of Linux for the Power Architecture hardware and is RPM-based, just like Red Hat Enterprise Linux and Fedora. YUP, and later YUM, were written by the Linux community as a way to maintain an RPM-based system.6. Explain how to uninstall the libraries in Linux ?_text]Answer:
By using the command sudo apt – get remove library_name.7. Can Linux computer be made a router so that several machines may share a single Internet connection? How ?_text]Answer:
Yes, a Linux machine can be made a router. This is called “IP Masquerade.” IP Masquerade is a networking function in Linux similar to the one-to-many (1: Many) NAT (Network Address Translation) servers found in many commercial firewalls and network routers.
The IP Masquerade feature allows other “internal” computers connected to this Linux box (via PPP, Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows this functionality even if the internal computers do not have IP addresses.
The IP masquerading can be done by the following steps :
The Linux PC must have an internet connection and a connection to LAN. Typically, the Linux PC has two network interfaces-an Ethernet card for the LAN and a dial-up PPP connection to the Internet (through an ISP).
All other systems on your LAN use the Linux PC as the default gateway for TCP/IP networking. Use the same ISP-provided DNS addresses on all systems.
Enable IP forwarding in the kernel. By default the IP forwarding is not enabled. To ensure that IP forwarding is enabled when you reboot your system, place this command in the /etc/rc.d/rc.local file.
Run /sbin/iptables-the IP packet filter administration program-to set up the rules that enable the Linux PC to masquerade for your LAN.8. What command can you use to make a tape archive file of a /home directory and send it to the /dev/tape device ?_text]Answer:
The correct command is tar -cvf /dev/tape /home.
The -xvf option is used to extract files from an archive.Expert Linux Professionals are in much demand.

Take this linux administration online certification & join the big league.
10. How to check and verify the status of the bond interface?
Using the command ‘cat /proc/net/bonding/bond0,’ we can check what mode is enabled and what LAN cards are used in this bond. In this example, we have one one bond interface. However, we can have multiple bond interfaces like bond1, bond2 and so on.

Basic Linux Interview Questions9. Suppose your FTP Server is hacked and the entire server needs to be restored. How should you restore the original kernel system files ?_text]Answer:
You cannot restore the entire operating system from tape backup device. So you should reinstall the core operating system, and then restore system configuration files and user data from tape backup device.10. What are system calls used for process management in Linux ?_text]Answer:
Process management in Linux uses certain system calls. These are mentioned in below table with a brief explanation

System calls Explanation
Fork() To create a new process
Exec() For execution of a new program
Wait() To make the process to wait
Exit() Exit/terminate the process
Getpid() To find the unique process id
Getppid() To find the parent process id
Nice() To bias the currently running process property

Top 43 Abinitio Interview Questions And Answers11. Enlist some Linux file content commands ?_text]Answer:
There are many commands present in Linux which are used to look at the contents of the file.

Some of them are enlisted below

head: Displays the beginning of the file
tail: Displays the last part of the file
cat: Concatenate files and print on the standard output.
more: Displays the content in pager form and is used to view text in the terminal window one page or screen at a time.
less: Displays the content in pager form and allows backward and single line movement.12. What are the basic components of Linux ?_text]Answer:
Just like other operating systems, Linux has all components like kernel, shells, GUIs, system utilities and application programs.13. What is the basic difference between BASH and DOS ?_text]Answer:
BASH commands are case sensitive while DOS commands are not case sensitive.
DOS follows a convention in naming files. In DOS, 8 character file name is followed by a dot and 3 characters for the extension. BASH doesn’t follow such convention.14. Why should you avoid Telnet to administer a Linux system remotely ?_text]Answer:
Telnet uses most insecure method for communication. It sends data across the network in plain text format and anybody can easily find out the password using the network tool. In the case of Telnet, these include the passing of login credentials in plain text, which means anyone running a sniffer on your network can find the information he needs to take control of a device in a few seconds by eavesdropping on a Telnet login session.15. Explain the features of Stateless Linux server ?_text]Answer:
The word stateless itself means ‘no state’. When on a single workstation, no state exists for the centralized server, and then the stateless Linux server comes into the picture. Under such conditions, scenarios like keeping all the systems on the same particular state can occur.

Some of the features of Stateless Linux server are explained below

Stores prototype of every machine
Store snapshots
Store home directories
Uses LDAP which determines the snapshot of state to be run on which system.16. What are Linux file systems ?_text]Answer:
By default, Linux supports and use ext3 or ext4 file systems. UNIX supports file systems like jfs, gpfs (AIX), jfs, gpfs (HP-UX), jfs, gpfs (Solaris).

Basic Linux Interview Questions17. What is du -s * | sort -k1,1rn | head command used for ?_text]Answer:
This command shows top disk users in current dir.18. Name a service that you should disable (which acts both as Web and FTP Server) on a Linux Server ?_text]Answer:
The finger service should be disabled because a remote user can get important information about the system by using that command.19. What is LD_LIBRARY_PATH ?_text]Answer:
LD_LIBRARY_PATH is an environment variable. It is used for debugging a new library or a non-standard library. It is also used to identify what directories need to be searched. Path to search for directories needs to given.
The variable can be set using setenv—LD_LIBRARY_PATH–$PATH.
It is used to search for the shared objects / dynamic libraries by the operating system for extendable functionality at runtime.
Prepare yourself for the Linux Certification with comprehensive Linux online training.20. Explain the work of Ctrl+Alt+Del key combination on Linux operating system ?_text]Answer:
The work of Ctrl+Alt+Del key combination on Linux operating system is same as is for Windows i.e. to restart the system. The only difference is that there is no confirmation message displayed and a system is rebooted directly.21. You wish to print a file ‘draft’ with 60 lines on a page. What command would you use ?_text]Answer:
The command used : pr -l60 draft
The default page length when using pr is 66 lines.
The -l option specifies a different length.22. Is it legal to edit the Linux kernel ?_text]Answer:
Yes, as it is under General Public License (GPL) and anyone can edit.23. Compare Linux & Windows ?_text]Answer:
Criteria Linux Windows
Type of OS Open Source Proprietary
Customization High level of customization Cannot be changed
Security Excellent Cannot be changed24. How do you kill program using one port in Linux ?_text]Answer:
Use this command to kills the program using one port: sudo fuser -k 8000/tcp

Basic Linux Interview Questions25. How do you limit memory usage for commands ?_text]Answer:
ulimit -Sv 1000 # 1000 KBs = 1 MB
ulimit -Sv unlimited # Remove limit26. What is ls command and what it does ?_text]Answer:
ls lists files in a directory. In Linux System admins and developers uses this command very often. In containers, ls command can help determine your container image’s directory and files.

ls Example:

$ ./myapp
bash: ./myapp: Permission denied
$ ls -l myapp
-rw-r–r–. 1 root root 33 Dec 17 15:27 myapp27. How do you get full path of a file in Linux ?_text]Answer:
Use this command: readlink -f file.txt28. What is the advantage of Linux ?_text]Answer:
Every aspect comes with additional features and it provides a free downloading facility for all codes.29. What is BASH ?_text]Answer:
BASH is a short form of Bourne Again SHell. It was a replacement to the original Bourne shell, written bu Steve Bourne.30. What is ps command in Linux?_text]Answer:
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 tomcat31. What is CLI?_text]Answer:
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 tomcat32. What is GUI?_text]Answer:
GUI stands for Graphical User Interface. It uses the images and the icons which are clicked by the users to communicate with the system. It is more attractive and user-friendly because the use of the images and icons.

Basic Linux Interview Questions33. What are the basic commands for user management?_text]Answer:
last,
chage,
chsh,
lsof,
chown,
chmod,
useradd,
userdel,
newusers etc.34. You want to send a message to all connected users as “Server is going down for maintenance”, what will you do ?_text]Answer:
This can be achieved using the wall command. The wall command sends a message to all connected users on the sever.35. Is Linux Operating system virus free ?_text]Answer:
No, There is no operating system till date that is virus free but Linux is known to have less number of viruses.36. What is the minimum number of partitions that you need to install Linux ?_text]Answer:
Minimum 2 partitions are needed for installing Linux37. What is the role of Kudzu ?_text]Answer:
Kudzu is used to detect new Hardware. RedHat Linux runs a hardware discoverer, named kudzu. When attempting to identify a serial port Kudzu resets the serial port. This stops the serial console. Kudzu is configured from the file/etc/sysconfig/kudzu.
Kudzu can be prevented from resetting hardware, by setting the configuration parameter SAFE to yes.38. What are the Linux Distribution (Operating System) Names ?_text]Answer:
A. Here are the some Linux operating system names:

Redhat Enterprise Linux
Fedora Linux
Debian Linux
Suse Enterprise Linux
Ubuntu Linux39. What is the difference between command ‘ping’ and ‘ping6’ ?_text]Answer:
Both the commands are same and used for the same purpose except that the fact that ping6 is used with ipv6 IP address.40. What are the file permissions in Linux ?_text]Answer:
There are 3 types of permissions in Linux OS that are given below:

Read: User can read the file and list the directory.
Write: User can write new files in the directory .
Execute: User can access and run the file in a directory.

Basic Linux Interview Questions41. How to exit from vi editor ?_text]Answer:
The following commands are used to exit from vi editor.

:wq saves the current work and exits the VI.
:q! exits the VI without saving current work.42. How to delete information from a file in vi ?_text]Answer:
The following commands are used to delete information from vi editor.

x deletes a current character.
dd deletes the current line.43. You need to stop your X server. When you tries to kill your X server, You got an error message that you cannot quit X server. What will you do?_text]Answer:
When killing a X server, it won’t work normal way like doing ‘/etc/init.d/gdm stop’. We need to execute a special key combination ‘Ctrl+ Alt+ Back Space’ which will force X server to restart.44. What is the core of Linux Operating System?_text]Answer:
Kernel is the core of Linux Operating System. Shell is a command Line Interpreter, Command is user Instruction to Computer, Script is collection of commands stored in a file and Terminal is a command Line Interface.45. What Linus Torvalds Created?_text]Answer:
Linux Torvalds created Linux, which is the kernel (heart) of all of the above Operating System and all other Linux Operating System.

Basic Linux Interview Questions46. How to copy text to clipboard?_text]Answer:
Use this command: cat file.txt | xclip -selection clipboard47. How do you check permissions of each directory to a file?_text]Answer:
It is useful to detect permissions errors, for example when configuring a web server.48. How do you check resources usage?_text]Answer:
Use this command to check resource usage: /usr/bin/time -v ls49. What is lsof command in Linux ?_text]Answer:
lsof command lists the open files associated with your application.50. What is df command in Linux ?_text]Answer:
Users can use df command to troubleshoot disk space issues. Here df stands for display free disk space.