Basic Linux Interview Questions And Answers

1. What is Linux?
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 a free and low-cost operating system for computer users.

2. Is it legal to edit the Linux kernel?
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?
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 0

4. What is YUM?
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?
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?
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?
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. (E learning portal)

8. What command can you use to make a tape archive file of a /home directory and send it to the /dev/tape device?
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.

09. How to check and verify the status of the bond interface?
Answer: 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.

10. What are system calls used for process management in Linux?
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 the 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

11. Enlist some Linux to file content commands?
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 the 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?
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?
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?
Answer: Telnet uses the 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?
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. (E learning Portal)

16. What are Linux file systems?
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).

17. What is du -s * | sort -k1,1rn | head command used for?
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?
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?
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 give.
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 the Linux operating system?
Answer: The work of Ctrl+Alt+Del key combination on the Linux operating system is the 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?

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?
Yes, as it is under General Public License (GPL) and anyone can edit.

23. Compare Linux & Windows?

  • Criteria Linux Windows
  • Type of OS Open Source Proprietary
  • Customization High level of
  • customization Cannot be changed
  • Security Excellent Cannot be changed

24. 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

25. How do you limit memory usage for commands?
ulimit -Sv 1000 # 1000 KBs = 1 MB
ulimit -Sv unlimited # Remove limit

26. What is ls command and what it does?
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 myapp

27. How do you get the full path of a file in Linux?
Use this command: reading -f file.txt

28. What is the advantage of Linux?
Answer: Every aspect comes with additional features and it provides a free downloading facility for all codes.

29. What is BASH?
Answer: BASH is a short form of Bourne Again SHell. It was a replacement to the original Bourne shell, written by Steve Bourne.

30. What is ps command in Linux?
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 tomcat

31. What is CLI?
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 tomcat

32. What is the GUI?
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 of the use of images and icons.

33. What are the basic commands for user management?

  • last,
  • change,
  • cash,
  • lsof,
  • chown,
  • chmod,
  • useradd,
  • userdel,
  • new users etc.

34. You want to send a message to all connected users as “Server is going down for maintenance”, what will you do?
This can be achieved using the wall command. The wall command sends a message to all connected users on the server.

35. Is Linux Operating system virus-free?
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?
Minimum 2 partitions are needed for installing Linux

37. What is the role of Kudzu?
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?
A. Here are the some Linux operating system names:

  • Redhat Enterprise Linux
  • Fedora Linux
  • Debian Linux
  • Suse Enterprise Linux
  • Ubuntu Linux

39. What is the difference between command ‘ping’ and ‘ping6’?
Answer: Both the commands are the 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?
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.

41. How to exit from vi editors?
The following commands are used to exit from vi editors.
: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?
The following commands are used to delete information from vi editors.
x deletes a current character.
dd deletes the current line.

43. You need to stop your X server. When you try to kill your X server, you got an error message that you cannot quit X server. What will you do?
Answer: When killing an 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+ BackSpace’ which will force X server to restart.

44. What is the core of the Linux Operating System?
Answer: The kernel is the core of Linux Operating System. Shell is a Command Line Interpreter, Command is user Instruction to Computer, Script is a collection of commands stored in a file and Terminal is a command Line Interface. 

45. What Linus Torvalds Created?
Answer: Linux Torvalds created Linux, which is the kernel (heart) of all of the above Operating System and all other Linux Operating System.

46. How to copy text to the clipboard?
Answer: Use this command: cat file.txt | clip -selection clipboard

47. How do you check permissions of each directory to a file?
Answer: It is useful to detect permissions errors, for example when configuring a web server.

48. How do you check resources usage?
Answer: Use this command to check resource usage: /usr/bin/time -v ls

49. What is lsof command in Linux?
Answer: lsof command lists the open files associated with your application.

50. What is df command in Linux?
Answer: Users can use the df command to troubleshoot disk space issues. Here df stands for display free disk space.

Note: Browse latest Linux Interview Questions and Linux Tutorial Videos. Here you can check Linux Training details and Linux Training Videos for self learning. Contact +91 988 502 2027 for more information.

Leave a Comment