Monday, 6 May 2024

100 Linux Interview Questions & Answers

1.What is Linux?

Answer: Linux is an operating system based on UNIX, and was first introduced by Linus Torvalds. It is based on the Linux Kernel, and can run on different hardware platforms manufactured by Intel, MIPS, HP, IBM, SPARC and Motorola. Another popular element in Linux is its mascot, a penguin figure named Tux.

2. What is the difference between UNIX and LINUX?

Answer :Unix originally began as a propriety operating system from Bell Laboratories, which later on spawned into different commercial versions. On the other hand, Linux is free, open source and intended as a non-propriety operating system for the masses.

3. Give me 15 commands which you use frequently.

Answer :Depends on the environment you work. Some examples are

mkdir – For creating folders( use -p option to create multiple folders at a time)

ls – List folders/files( check what ls -1 do)

top – To monitor system activities

To check whats happening on the server and which process open which file.

netstat -tcp –Gives you complete picture about network connection details.

vnstat –Gives you Network band width statics

sh –For running shell scripts

history –For monitoring the commands executed by users

cd –For changing directories

vi –-For editing configuration files.

chmod–To change permissions of folders and files.

Mount –For mounting formatted partitions.

service –For start/restart/stop a service.

chkconfig –For permanent on/off a service.

fdisk -l –To list all the partitions

This is my own list, you can have your list.

4. Give me some commands for user management.

Answer: last, chage, chsh, lsof, chown, chmod, useradd, userdel, newusers.

5. Give me syntax checking commands for following services

Answer: DNS, SAMBA, Apache etc

6. What is the command to do password less logins to other machines.

Answer: expect and ssh-keygen

7. Give me some security monitoring related commands.

Answer: lsof, netstat, top, ps -ef, tail, last, tcpdump, sestatus, history, w.

8. What is the difference between man, info, whatis commands and a –help option for a command?

Answer: man command gives you medium size info.

info command gives full details about a commands, lots and lots of information about a command. Please share your interview questions with us, we post them here so that others can get help from this.

9. What is Kerberos used for?

Answer: Kerberos is used for secure network logon.

10. Which partition store system configuration files in Linux system?

Answer: /etc partition stores system configuration files in Linux.

11. What is the purpose of the MD5 option on passwords?

Answer : MD5 is an encryption method that encrypts the password before saving.

Name any four general password rules for user account.

Answer:

  •  Include at least eight total characters
  • Use the string in an unrepeated way
  • Avoid use words that can be found in the dictionary
  •  Avoid use dates of significance, such as a birthday or anniversary A better method of password security is to create difficult-to-break passwords that are easy for the users to remember.

12. What is the alternative method to a GUI installation in Linux?

Answer : Linux provides text base installation as the alternative method of GUI installation.

13. What is the purpose of the swapon command?

Answer : swapon command is used to activate a already created swap partition. It cannot be used to create a new swap partition.

14. What is gzip?

Answer: gzip is a compression utility created by the GNU project.

15. What is tar?

Answer : tar is an archive utility that is used to create tape backups.

16. Which is the standard command used to uncompress gzip files?

Answer : The standard command used to uncompress gzip files is gunzip.

17. What is the RPM switch for only installing packages?

Answer : The command line switch for installing an RPM is -i.

18. What is the command used to install an RPM package named demofilename2.2- 2.i386.rpm?

Answer : The most common command used to install an RPM package is rpm -ivh. Following command will install the given package

#rpm -ivh demofilename2.2-2.i386.rpm

19. What is the command used to remove an RPM package named demofilename2.2- 2.i386.rpm?

Answer : The most common command used to remove an RPM package is rpm -evh. Following command will remove the given package

#rpm -evh demofilename2.2-2.i386.rpm

20. What is the command used to update an RPM package named demofilename2.2- 2.i386.rpm?

Answer : The most common command used to update an RPM package is rpm -Uvh. Following command will update the given package and remove the old.

#rpm -Uvh demofilename2.2-2.i386.rpm

21. PPP is most often used to create?

Answer: PPP is most often used to create serial point-to-point connections.

22. What fstab file do?

Answer : The fstab file is used to automatically mount file systems.

23. What inittab file do?

Answer : The /etc/inittab file is used to perform the default state and terminal connections for a Linux system.

24. What command can you use to verify the current active shell?

Answer : The env command will display the current active shell.

25. Where is the file. bashrc located?

Answer : The. bashrc file is usually located in the /home/username directory.

26. What function does the .bash_profile file perform?

Answer : The function of the .bash_profile file is to provide login initialization commands.

27. What function does the .bash_logout file perform?

Answer : The function of the .bash_logout is to provide logout functions

28. What function does the .bashrc file perform?

Answer : The function of the .bashrc file is to provide shell configuration commands.

29. What command would you use to shut down the system in 100 seconds?

Answer : #shutdown -h 100

30. What daemon controls the print spooling process?

Answer : The Line Printing Daemon (lpd) controls the print spooling process.

31. What configuration file defines the default runlevel for the init process?

Answer :/etc/inittab file defines the default runlevel for the init process.

32. Which command can you use to shut down and halt a Linux System?

Answer : The halt command will shut down a Linux system without rebooting

33. What init level should you set to bring the system to single-user mode?

Answer : init 1 will bring the system to single-user mode

34. A user wants to restart the NFS server because they want to enable changes made in the configuration file. What command accomplishes this task?

Answer : #service nfs reload

The reload command will tell the system to stop the service, reload the configuration file, and restart the service

35. What command can you use to reboot a Linux system?

Answer : The command to reboot a Linux system is reboot

36. What mode must you be in when using vi editor to input text into a file?

Answer : To insert text in the vi editor, you must be in insert mode

37. What is BASH?

Answer : BASH is short for Bourne Again SHell. It was written by Steve Bourne as a replacement to the original Bourne Shell (represented by /bin/sh). It combines all the features from the original version

of Bourne Shell, plus additional functions to make it easier and more convenient to use. It has since been adapted as the default shell for most systems running Linux.

38. What is Linux Kernel?

Answer : The Linux Kernel is a low-level systems software whose main role is to manage hardware resources for the user. It is also used to provide an interface for user-level interaction.

39. What is LILO?

Answer : LILO is a boot loader for Linux. It is used mainly to load the Linux operating system into main memory so that it can begin its operations.

40. What is a swap space?

Answer : A swap space is a certain amount of space used by Linux to temporarily hold some programs that are running concurrently. This happens when RAM does not have enough memory to hold all programs that are executing.

41. What is the advantage of open source?

Answer : Open source allows you to distribute your software, including source codes freely to anyone who is interested. People would then be able to add features and even debug and correct errors that are in the source code. They can even make it run better, and then redistribute these enhanced source code freely again. This eventually benefits everyone in the community.

42. What are the basic components of Linux?

Answer : Just like any other typical operating system, Linux has all of these components: kernel, shells and GUIs, system utilities, and application program. What makes Linux advantageous over other operating system is that every aspect comes with additional features and all codes for these are downloadable for free.

43. Does it help for a Linux system to have multiple desktop environments installed?

Answer : In general, one desktop environment, like KDE or Gnome, is good enough to operate without issues. It’s all a matter of preference for the user, although the system allows switching from one environment to another. Some programs will work on one environment and not work on the other, so it could also be considered a factor in selecting which environment to use.

44. A newbie enabled the root session for FTP server. is it ok?

Answer : No, he has put the security of entire server on risk. You should disable to root session as soon as possible.

45. A user complains you that he is unable to set ‘123’ as his password. Why would not the system allow this password?

Answer : There would be a minimum length rule for password, which is blocking user to use this password. Default minimum length rule for password is six characters. It means a user cannot have password less than six characters.

46. Your company is running Web Server. One dedicate account holder customer complains that his visitors are able to scan the directory tree. Which directive would you configure to stop web server from listing the directory?

Answer : You should remove/ comment the “Options Indexes” directive from the main configuration file ‘ httpd.conf’ of the web server. This is a security measure so that remote users can’t scan the directory tree of the server looking for security holes. Server won’t show directory listings if requested by a user.

47.What type of backup strategy can you use to fully back up a system every night?

Answer : You can use full backup strategy that will always perform a full backup of all files. This takes much more time and space than other methods, but is it the most complete method and allows for easy file restoration.

48. How can you enhance the security of password file?

Answer : Linux keep user account information in a text file called /etc/passwd. This file also store one way encrypted password. This file is accessed by several tools to get user information, so file need to world readable. This is a security risk. To minimize the security risk you can use shadow password format. This method save account information in regular file /etc/passwd. However, the password is stored as a single “x” character (not actually stored in this file). A second file, called “/etc/shadow”, contains encrypted password as well as other information such as account or password expiration values, etc. The /etc/shadow file is readable only by the root account and is therefore less of a security risk

49. What command should be used to make a tar archive to a disk file system located in /mnt/backup?

Answer : The correct command is tar -cvf /mnt/backup. The /mnt/backup directory should be on another machine to be fully effective as a backup strategy.

50. You have just finished the installation of sever. This server is going to be use as file server. Default installation have send mail service running, while this server will never send any e-mails. How should you deal with send mail service?

Answer : You should disable the send mail service if server is not being used for mail purpose. Leaving them running can increase the chance of a security vulnerability being exploited, and unauthorized use of sendmail relay.

51. What command can you use to back up an entire file system most efficiently?

Answer : The easiest command to use to back up an entire file system is the dump command. Files can

be restored from a dump operation by using the restore command.

52. Which necessary steps should you take to enhance the security of server just after the initial installation?

Answer:

  • Kernel and packages should be upgraded to the latest versions.
  • Unnecessary services and daemons should be disable.
  • Enable and configure firewall
  • Set a complex password policy

53. While auditing user accounts, an administrator notices that one of the users has a blank password. What should he do to the account?

Answer : To prevent further use of the account, which is an immediate security risk, disable it and set a temporary password for the user for the next time they login.

54. Which backup strategy backs up all files that have changed since the last backup?

Answer : An incremental backup will only back up files that have changed since the last backup.

55. Your company has terminated a server administrator. What is first thing as an administrator should you do to enhance the security?

Answer : Because the server administrator knows the root password for the server, it should be changed immediately to prevent them from tampering with the system.

56. You are setting up an FTP server. Only company employees are allowed to use the FTP services. What should you configure on the FTP server to enhance security?

Answer : You should disable the anonymous FTP account, so that only users with a username and password can access the system.

57. What is the location of system configuration files that should be backed up on a regular basis?

Answer : The /etc directory contains most of the Linux system configuration files.

58. Which permission allows a user to run an executable with the permissions of the owner of that file?

Answer : The Set-User-ID is a special permission that allows a user to run an executable with the permissions of the owner of that file.

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

60. Employees at your company are lazy in changing the password. As a system administrator what can you do to minimize the security risk?

Answer : You can setup a password policy which enforce user to change his password after a specific time periods.

61. Which program should you use to connect a system remotely?

Answer : You should always use SSH to connect a system remotely. SSH is a secure method that encrypts the entire session.

62. To save disk space, an administrator wants to backup files, and then remove them from the server permanently. What kind of backup operation is this?

Answer : An archive operation will take the files, back them up to a device, and then remove the files from the original server.

63. What does firewall do?

Answer : Firewall is a device or service which can be used to protect the network or system from other outside networks.

64. Due to power fluctuation, your system starts up from a powered off state. You receive a warning error stating that the machine was not shut down properly, and fsck will be run. What is the cause of this message?

Answer : If your hard drive file systems are not unmounted properly, the fsck utility will automatically run the next time the system is started to fix any inconsistencies before they are mounted again. If they are not fixed, the file system can quickly become corrupt.

65. A junior system administrator is trying to read through a large log file using the cat command. Because it is so large, the cat command scrolls the file right to the end without allowing the start of the file to be read. What command can he be used to more easily read the file?

Answer : He can use less command instead of using cat command, which allows him to scroll through the file.

66. When you try to boot a Linux system, you receive a message stating that it canot mount the /home partition because of errors. While debugging, you found that it occur due to data error. What can you do to fix the problem?

Answer : You can use fsck utility that enable you to recover from the errors.

67. During the bootup of a Linux system, there is no output on the monitor, the machine beeps, and then halts the boot-up process. What is the most likely cause of the problem?

Answer : If the system would not even get to the POST stage, the problem is most likely with the motherboard itself. You should count and compare the number of beeps to the BIOS manual in order to determine which specific component failed.

68. Which utility could you use to repair the corrupted file system?

Answer : You can use fsck to repair the corrupted file system.

69. What is the core of Linux Operating System?

  1.  Shell
  2.  Kernel
  3.  Command
  4.  Script
  5.  Terminal

Answer: 3. 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

70. What Linus Torvalds Created?

  1.  Fedora
  2.  Slackware
  3.  Debian
  4.  Gentoo
  5.  Linux

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

71. Torvalds, Wrote most of the Linux Kernel in C++ programming Language, do you agree?

Answer: No! Linux Kernel contains 12,020,528 Lines of codes out of which 2,151,595 Lines are comments. So remaining 9,868,933 lines are codes and out of 9,868,933 Lines of codes 7,896,318 are written in C Programming Language.

The remaining Lines of code 1,972,615 is written in C++, Assembly, Perl, Shell Script, Python, Bash Script, HTML, awk, yacc, lex, sed, etc.

Note: The Number of Lines of codes varies on daily basis and an average of more than 3,509 lines are being added to Kernel.

72. Linux initially was developed for intel X86 architecture but has been ported to other hardware platform than any other Operating System. Do you agree?

Answer: Yes, I do agree. Linux was written for x86 machine, and has been ported to all kind of platform. Today’s more than 90% of supercomputers are using Linux. Linux made a very promising future in mobile phone, Tablets. In-fact we are surrounded by Linux in remote controls, space science, Research, Web, Desktop Computing. The list is endless.

73. Is it legal to edit Linux Kernel?

Answer: Yes, Kernel is released under General Public Licence (GPL), and anyone can edit Linux Kernel to the extent permitted under GPL. Linux Kernel comes under the category of Free and Open Source Software (FOSS).

74. What is the basic difference between UNIX and Linux Operating System.

Answer: Linux Operating System is Free and Open Source Software, the kernel of which is created by Linus Torvalds and community. Well you can not say UNIX Operating System doesn’t comes under the category of Free and Open Source Software, BSD, is a variant of UNIX which comes under the category of FOSS. Moreover Big companies like Apple, IBM, Oracle, HP, etc. are contributing to UNIX Kernel.

75. What is the difference between service and process?

Answer: A process is any piece of software that is running on a computer. For example, your anti-virus software runs in the background as a process, which was automatically started when the computer booted. Some processes start when your computer boots, others are started manually when needed. Some processes are services that publish methods to access them, so other programs can call them as needed. Printing services would be an example of a service type of process, where your email program can just call the print services process to say it wants to print, and the service does the actual work.

76. How to view crond status?If it’s show service is not found.

Answer: Service crond restart

77. My clients are getting services from servers but how to know which client is using which service. is there any files to keep information about these? Clients used ftp, nis, samba, apache, squid, nfs and mail services how to know how many users got service from server side with date, time and client system ip?

Answer :

Mail server – /var/log/mail/maillog [RedHat,centos]
ssh – /var/log/secure
Apache – /var/log/http/access.log
nfs – /var/lib/nfs/rmtab

78. How to FTP user access other directory except his own home directory?

Answer :

vim /etc/vsftpd/vsftpd.conf
Chroot_list_enable=yes

79. What are the Linux-based security tools?

Answer:

  • Selinux
  • Firewall
  • iptables
  • Tcp-wrappers

80. What are the basic elements of firewall?

Answer: A firewall should be able to filter packets (drop/pass them) based on certain rules specified by the user. The rules may be used to identify an incoming packet to the computer or outgoing packet from the computer, it can be based on target port number/ip add, traffic from a particular Network card etc…

The firewall rules can be in a tabular form (saved on the disk) from where the firewall software can read them and implement it. iptables firewall on Linux is a great example

81. What is a command to display top 10 users who are using huge space?

Answer: du -sh /home/* | sort -r | head -10

82. How do find all failed login attempts via ssh?

Answer: tail -f /var/log/secure | grep Failed

83. How do you configure Linux system as a router?

Answer:

vim /etc/sysctl.conf
net.ipv4.ip_forward=1
system-config-network
eth0 192.168.1.120 eth0:1 172.24.0.1
255.255.255.0 255.255.0.0
172.24.0.1 192.168.1.120

84. What is the UID and GID of root user? Can a normal user can change the ownership of a file? What is the command to change ownership of a file?

Answer: The root UID/GID is 0 (zero). Which is why he can able to intervene in all normal users files even though he don’t had permission. A normal user will don’t have the permission to change ownership of file. The command to change ownership is < chown user.user file >

85. What is the diff b/w ext2 and ext3?

Answer : Ext3 is a tiny bit slower than ext2 is, but it holds tremendous advantages. There is really only one difference between ext2 and ext3, and that is that ext3 uses a journal to prevent filesystem corruption in the case of an unclean shutdown (ie. before the filesystem is synced to disk). That makes ext3 a bit slower than ext2 since all metadata changes are written to the journal, and then flushed to disk, but on the other hand you don’t risk having the entire filesystem destroyed at power failure or if an unwitted person turns the computer off uncleanly. You don’t have to check the filesystem after an unclean shutdown either. Ext3 has three levels of journalling. Metadata (ie. internal filesystem structures) are always journalled, so that the filesystem itself is never corrupted. How ordinary data is written to the file system is controllable, though. The default option is the “ordered” mode, which causes file contents to be written to the filesystem before metadata is even committed to the journal. The highest reliable mode is called the “journal” mode, which causes file data to be committed to the journal before it is flushed to its final place, like the metadata. The least reliable mode, but rumoured to be the fastest, is called the “writeback” mode, which makes no promises at all regarding the consistency of file data. Only metadata is output reliably in writeback mode. So as for anything else, it’s mainly a matter of priority. If you don’t want ultimate speed, go with ext3. If you need the highest speed that is theoratically aquirable though, then go with ext2. For that to be effective you’ll probably need a really advanced hard drive controller, though.

86. As the system administrator you need to review Bob’s cronjobs. What command would you use?

Answer: crontab –lu Bob

87. What command is used to remove the password assigned to a group?

Answer: gpasswd –r groupname

88. What are the different RAID levels?

Answer:

  • RAID level 0
  • RAID level RAID level 1
  • RAID level 2
  • RAID level 3
  • RAID level 4
  • RAID level 5
  • RAID level 6
  • RAID level 10
  • RAID level 50

89. How do you create a swapfile?

Answer:

dd if=/dev/zero of=/swapfile bs=1024 count=200M
mkswap /swapfile
swapon /swapfile

90. What does nslookup do?

Answer: Nslookup is a program used to find information about internet Domain Name server. The two modes of nslookup are: Interactive and non-interactive. Using ‘interactive mode’ user can query the name servers for the information pertaining to hosts and domains.

Using ‘non-interactive mode’ the user can just print the name and requested information of a host.

91. What is Linux and why is it so popular?

Answer : Linux is an operating system that uses UNIX like Operating system.

Unix interview questions with answers

92. How we can configure data hard derive during redhat 9 installation.

Answer : Have the data driver on a floppy drive. At the start of installation, when u boot from the CD/DVD, on the prompt, write “dd”. It will ask for the driver floppy later on and will load the sata driver. Then you can configure/partition the drive using disk druid or fdisk.

93. What is LILO?

Answer: LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start the Operating system.

94. What is the difference between home directory and working directory?

Answer : Home directory is the default working directory when a user logs in. On the other hand, working directory is the user’s current directory.

95. What is the difference between internal and external commands?

Answer : Internal commands are commands that are already loaded in the system. They can be executed any time and are independent.

96. Explain the difference between a static library and a dynamic library.

Answer: Static libraries are loaded when the program is compiled and dynamically-linked libraries are loaded in while.

97. What is LD_LIBRARY_PATH?

Answer : LD_LIBRARY_PATH is an environment variable. It is used for debugging a new library or a non standard library.

98.What is the file server in Linux server?

Answer : File server is used for file sharing. It enables the processes required for sharing.

99. What is NFS? What is its purpose?

Answer : NFS is Network File system. It is a file system used for sharing of files over a network.

100. How do I send email with linux?

Answer : Email can be sent in Linux using the mail command. 

Linux Interview Questions and Answers

 

1. What is Linux?

Linux is an operating system which is based on UNIX, and was first introduced by Linus Torvalds. It is based on the Linux Kernel, and can run on different hardware platforms manufactured by Intel, MIPS, HP, IBM, SPARC and Motorola. Another popular element in Linux is its mascot, a penguin figure named Tux.

Q2. What is the difference between UNIX and LINUX?

Unix originally began as a propriety operating system from Bell Laboratories, which later on spawned into different commercial versions. On the other hand, Linux is free, open source and intended as a non-propriety operating system for the masses.

Q3. What is BASH?

BASH is short for Bourne Again SHell. It was written by Steve Bourne as a replacement to the original Bourne Shell (represented by /bin/sh). It combines all the features from the original version of Bourne Shell, plus additional functions to make it easier and more convenient to use. It has since been adapted as the default shell for most systems running Linux.

Q4. What is Linux Kernel?

The Linux Kernel is a low-level systems software whose main role is to manage hardware resources for the user. It is also used to provide an interface for user-level interaction.

Q5. What is LILO?

LILO is a boot loader for Linux. It is used mainly to load the Linux operating system into main memory so that it can begin its operations.

Q6. What is a swap space?

A swap space is a certain amount of space used by Linux to temporarily hold some programs that are running concurrently. This happens when RAM does not have enough memory to hold all programs that are executing.

Q7. What is the advantage of open source?

Open source allows you to distribute your software, including source codes freely to anyone who is interested. People would then be able to add features and even debug and correct errors that are in the source code. They can even make it run better, and then redistribute these enhanced source code freely again. This eventually benefits everyone in the community.

Q8. What are the basic components of Linux?

Just like any other typical operating system, Linux has all of these components: kernel, shells and GUIs, system utilities, and application program. What makes Linux advantageous over other operating system is that every aspect comes with additional features and all codes for these are downloadable for free.

Q9. Does it help for a Linux system to have multiple desktop environments installed?

In general, one desktop environment, like KDE or Gnome, is good enough to operate without issues. It’s all a matter of preference for the user, although the system allows switching from one environment to another. Some programs will work on one environment and not work on the other, so it could also be considered a factor in selecting which environment to use.

Q10. What is the basic difference between BASH and DOS?

The key differences between the BASH and DOS console lies in 3 areas:
– BASH commands are case sensitive while DOS commands are not;
– under BASH, / character is a directory separator and \ acts as an escape character. Under DOS, / serves as a command argument delimiter and \ is the directory separator
– DOS follows a convention in naming files, which is 8 character file name followed by a dot and 3 character for the extension. BASH follows no such convention.

Q11. What is the importance of the GNU project?

This so-called Free software movement allows several advantages, such as the freedom to run programs for any purpose and freedom to study and modify a program to your needs. It also allows you to redistribute copies of a software to other people, as well as freedom to improve software and have it released to the public.

Q12. Describe the root account.

The root account is like a systems administrator account, and allows you full control of the system. Here you can create and maintain user accounts, assigning different permissions for each account. It is the default account every time you install Linux.

Q13. What is CLI?

CLI is short for Command Line Interface. This interface allows user to type declarative commands to instruct the computer to perform operations. CLI offers an advantage in that there is greater flexibility. However, other users who are already accustom with using GUI find it difficult to remember commands including attributes that come with it.

Q14. What is GUI?

GUI, or Graphical User Interface, makes use of images and icons that users click and manipulate as a way of communicating with the computer. Instead of having to remember and type commands, the use of graphical elements makes it easier to interact with the system, as well as adding more attraction through images, icons and colors.

Q15. How do you open a command prompt when issuing a command?

To open the default shell (which is where the command prompt can be found), press Ctrl-Alt-F1. This will provide a command line interface (CLI) from which you can run commands as needed.

Q16. How can you find out how much memory Linux is using?

From a command shell, use the “concatenate” command: cat /proc/meminfo for memory usage information. You should see a line starting something like: Mem: 64655360, etc. This is the total memory Linux thinks it has available to use.

Q17. What is typical size for a swap partition under a Linux system?

The preferred size for a swap partition is twice the amount of physical memory available on the system. If this is not possible, then the minimum size should be the same as the amount of memory installed.

Q18. What are symbolic links?

Symbolic links act similarly to shortcuts in Windows. Such links point to programs, files or directories. It also allows you instant access to it without having to go directly to the entire pathname.

Q19. Does the Ctrl+Alt+Del key combination work on Linux?

Yes, it does. Just like Windows, you can use this key combination to perform a system restart. One difference is that you won’t be getting any confirmation message and therefore, reboot is immediate.

Q20. How do you refer to the parallel port where devices such as printers are connected?

Whereas under Windows you refer to the parallel port as the LPT port, under Linux you refer to it as /dev/lp . LPT1, LPT2 and LPT3 would therefore be referred to as /dev/lp0, /dev/lp1, or /dev/lp2 under Linux.

Q21. Are drives such as harddrive and floppy drives represented with drive letters?

No. In Linux, each drive and device has different designations. For example, floppy drives are referred to as /dev/fd0 and /dev/fd1. IDE/EIDE hard drives are referred to as /dev/hda, /dev/hdb, /dev/hdc, and so forth.

Q22. How do you change permissions under Linux?

Assuming you are the system administrator or the owner of a file or directory, you can grant permission using the chmod command. Use + symbol to add permission or – symbol to deny permission, along with any of the following letters: u (user), g (group), o (others), a (all), r (read), w (write) and x (execute). For example the command chmod go+rw FILE1.TXT grants read and write access to the file FILE1.TXT, which is assigned to groups and others.

Q23. In Linux, what names are assigned to the different serial ports?

Serial ports are identified as /dev/ttyS0 to /dev/ttyS7. These are the equivalent names of COM1 to COM8 in Windows.

Q24. How do you access partitions under Linux?

Linux assigns numbers at the end of the drive identifier. For example, if the first IDE hard drive had three primary partitions, they would be named/numbered, /dev/hda1, /dev/hda2 and /dev/hda3.

Q25. What are hard links?

Hard links point directly to the physical file on disk, and not on the path name. This means that if you rename or move the original file, the link will not break, since the link is for the file itself, not the path where the file is located.

Q26. What is the maximum length for a filename under Linux?

Any filename can have a maximum of 255 characters. This limit does not include the path name, so therefore the entire pathname and filename could well exceed 255 characters.

Q27. What are filenames that are preceded by a dot?

In general, filenames that are preceded by a dot are hidden files. These files can be configuration files that hold important data or setup info. Setting these files as hidden makes it less likely to be accidentally deleted.

Q28. Explain virtual desktop.

This serves as an alternative to minimizing and maximizing different windows on the current desktop. Using virtual desktops, each desktop is a clean slate where you can open one or more programs. Rather than minimizing/restoring all those programs as needed, you can simply shuffle between virtual desktops with programs intact in each one.

Q29. How do you share a program across different virtual desktops under Linux?

To share a program across different virtual desktops, in the upper left-hand corner of a program window look for an icon that looks like a pushpin. Pressing this button will “pin” that application in place, making it appear in all virtual desktops, in the same position onscreen.

Q30. What does a nameless (empty) directory represent?

This empty directory name serves as the nameless base of the Linux file system. This serves as an attachment for all other directories, files, drives and devices.

Q31. What is the pwd command?

The pwd command is short for print working directory command. It’s counterpart in DOS is the cd command, and is used to display the current location in the directory tree.

Q32. What are daemons?

Daemons are services that provide several functions that may not be available under the base operating system. Its main task is to listen for service request and at the same time to act on these requests. After the service is done, it is then disconnected and waits for further requests.

Q33. What are the kinds of permissions under Linux?

There are 3 kinds of permissions under Linux:
– Read: users may read the files or list the directory
– Write: users may write to the file of new files to the directory
– Execute: users may run the file or lookup a specific file within a directory

Q34. How do you switch from one desktop environment to another, such as switching from KDE to Gnome?

Assuming you have these two environments installed, just log out from the graphical interface. Then at the Log in screen, type your login ID and password and choose which session type you wish to load. This choice will remain your default until you change it to something else.

Q35. How does case sensitivity affect the way you use commands?

When we talk about case sensitivity, commands are considered identical only if every character is encoded as is, including lowercase and uppercase letters. This means that CD, cd and Cd are three different commands. Entering a command using uppercase letters, where it should be in lowercase, will produce different outputs.

Q36. What are environmental variables?

Environmental variables are global settings that control the shell’s function as well as that of other Linux programs. Another common term for environmental variables is global shell variables..

Q37. What are the different modes when using vi editor?

There are 3 modes under vi:
– Command mode – this is the mode where you start in
– Edit mode – this is the mode that allows you to do text editing
– Ex mode – this is the mode wherein you interact with vi with instructions to process a file

Q38. Is it possible to use shortcut for a long pathname?

Yes, there is. A feature known as filename expansion allows you do this using the TAB key. For example, if you have a path named /home/iceman/assignments directory, you would type as follows: /ho[tab]/ice[tab]/assi[tab] . This, however, assumes that the path is unique, and that the shell you’re using supports this feature.

Q39. What is redirection?

Redirection is the process of directing data from one output to another. It can also be used to direct an output as an input to another process.

Q40. What is grep command?

grep a search command that makes use of pattern-based searching. It makes use of options and parameters that is specified along the command line and applies this pattern into searching the required file output.

Q41. What could possibly be the problem when a command that was issued gave a different result from the last time it was used?

One highly possible reason for getting different results from what seems to be the same command has something to do with case sensitivity issues. Since Linux is case sensitive, a command that was previously used might have been entered in a different format from the present one. For example, to lists all files in the directory, you should type the command ls, and not LS. Typing LS would either result in an error message if there is no program by that exact name exist, or may produce a different output if there is a program named LS that performs another function.

Q42. What are the contents in /usr/local?

It contains locally installed files. This directory actually matters in environments where files are stored on the network. Specifically, locally-installed files go to /usr/local/bin, /usr/local/lib, etc.). Another application of this directory is that it is used for software packages installed from source, or software not officially shipped with the distribution.

Q43. How do you terminate an ongoing process?

Every process in the system is identified by a unique process id or pid. Use the kill command followed by the pid in order to terminate that process. To terminate all process at once, use kill 0.

Q44. How do you insert comments in the command line prompt?

Comments are created by typing the # symbol before the actual comment text. This tells the shell to completely ignore what follows. For example: “# This is just a comment that the shell will ignore.”

Q45. What is command grouping and how does it work?

You can use parentheses to group commands. For example, if you want to send the current date and time along with the contents of a file named OUTPUT to a second file named MYDATES, you can apply command grouping as follows: (date cat OUTPUT) > MYDATES

Q46. What is the command to calculate the size of a folder?

To calculate the size of a folder use the command du –sh folder1.

Q47. How can you find status of a process?

Use the command- ps ux.

Q48. How can you check the memory status ?

You can use the command
free -m to display output in MB
free -g to display output in GB

Q49. Explain how to enable root loging in Ubuntu?

The command which enables root loging is
#sudo sh-c ‘echo “greater-show-manual-login=true” >>/etc/lightdm/lightdm.conf’

Q50. Explain how to uninstall the libraries in Linux?

To uninstall the libraries in Linux, you can use command sudo apt – get remove library_name

Top 30 Red Hat Linux Interview Questions and Answers

 1. What is meant by Red Hat Linux?

Linux is one of the most commonly used operating systems across the globe. It is even a more popular choice than a Windows operating system. Thanks to it being an open-source platform. On top of that, it is also a free and economical operating system.

Other important points include that it is user-friendly.

The Red Hat is one of the many distribution organizations of Linux operating system, and in fact, it is one of the most reliable one. It can do the following:

  • It can help scale up existing applications.
  • It helps to bring out new technologies such as containers, cloud, automation, virtual environments, SDKs, and microservices, etc.

2. What are some of the benefits of Red Hat Linux?

The following are some of the significant benefits of the Red Hat Linux:

  • Red Hat Linux is an open-source software.
  • It offer a GUI (Graphic User Interface) Operating system.
  • You can also access open-source technical support unlike other Linux distribution vendors that charge a hefty fee for resolving technical issues.
  • It helps in completing basic command-line tasks.

3. What is meant by Red Hat network?

To conclude, Red Hat network is a system management platform. It particularly helios the users with an effective lifecycle management of various apps and operating systems. The other features of the Red Hat network include:

  • Installing and setting up fresh Linux systems. 
  • Handling of configuration files.
  • System reconfiguration for hosted and satellite deployment architectures.
  • System updates.
  • Performance evaluation.

4. How can you verify the uptime of a Linux server?

In order to verify the uptime of a Linux server, you can use command line. The best command is the ‘uptime’ command. By running this command, you get to know the time span of how long the Linux box ran. Other commands you can use include:

  • w command
  • top command

5. How can you rename a file in Red Hat Linux?

You can follow the below mentioned steps to rename a file in Red Hat Linux:

  • First of all, open the Linux shell command line.
  • Use the “mv” command in the command line interface.
  • This program will showcase both the orginical and newly named files/
  • It is important to double-check all the parameters before renaming the files.
  • Sometimes, a user forgets to check few parameters. In such cases,, the command prompts you to recheck them.

6. What is a puppet server?

A server that use an operating system similar to Unix is known as a puppet server. 

This business application is great for managing setups overall. 

The significant functionalities of the puppet server includes the following:

  • This application is 100% open-source and fully automated, to be more precise.
  • This enables you to use codes to communicate instructions to puppet agents.
  • Puppet code can be used for a variety of tasks, including updating user accounts, checking the rights on files, and installing new software.

7. What is meant by LILO?

A Linux boot loader is called LILO. It is primarily used to start the Linux operating system’s activities by loading it into main memory.

8. What is meant by SELinux?

SELinux is an acronym for Security-Enhanced Linux. As the name suggests, it provides protection to the server against any malicious activities such as misconfigurations or hacked daemons. Security policy specifies the procedures that must be followed and is used to establish limits and instruct server applications on how to access certain or permission-granted files.

9. What do you understand by Linux Kernel?

The heart of Linux operating systems is the Linux Kernel. The main goal of the Linux Kernel, a low-level piece of systems software, is to manage hardware resources on behalf of the user. Additionally, it serves as a user interface for interactions at the user level.

Linux Kernel

10. How can you change the User Password?

Users can modify their passwords by using the command “passwd”. The command must be executed through the prompt while the current password is being input. Type the new password next and you are good to go!

11. Mention the basic components of Linux.

The following are the main components of Linux:

  • Linux kernel
  • Shells
  • Graphical User Interface (GUI)
  • System utilities
  • Application program

12. What do you understand by CLI?

Command Line Interface, or CLI, is an abbreviation. With the use of this interface, a user can order the computer to do actions by typing logical commands. CLI provides more versatility. However, some users who are already familiar with using GUI find it challenging to remember instructions and associated attributes.

13. What are the different types of Linux user modes available?

There are two main types of user modes available:

  • Graphical User Interface (GUI)
  • Command Line Interface (CLI)

14. How can you open a command prompt to pass a command?

You can follow the following quick steps to open the command prompt:

  • The command prompt is present in the default shell. 
  • You need to press Ctrl-Alt-F1. If you’re using a Mac, you can also use the Terminal app to run the bash scrips. 
  • Voila! You can then access the command line interface (CLI) where you can run all the commands you need.

15. Which is more secure: Windows or Linux? And Why?

Linux Operating systems are more secure as compared to the Windows operating system. The reasons are mentioned below:

  • The Linux operating system offers a number of working environments, all of which contain virus protection, such as Linux Mint, Debian, Arch, and others.
  • In order to rapidly view the specifics of the system files afterwards, it keeps a log history.
  • A Linux feature called Iptables looks at the system’s security perimeter.
  • Security will be improved because there are less people using Linux than other operating systems.
  • A small number of persons have access to the Linux system. As a result, the virus can only possibly harm a small number of files rather than the entire system.
  • Linux users must finish the steps before accessing the files in order to safeguard their systems from vulnerabilities.

16. What are the various available run levels in Linux?

The various run levels that are present in Linux are mentioned below:

  • System of halt (attempted system shutdown)
  • There won’t be an NFS option, but there will be a multi-user option.
  • Setting for individual users
  • The whole multi-user mode (based on the text)
  • Graphical user interface mode for numerous users
  • Unused
  • Launch the computer again

17. How can you install rpm packages?

We can install the rpm packages by using the command line. It could easily be installed in Red Hat Linux operating system by using the yum and rpm command lines.

18. What is meant by load balancing cluster?

The concept of load balancing cluster could be understood from the following pointers:

  • The cluster for load balancing is used to distribute the load among the cluster nodes. 
  • When the cluster sends the service request to a different cluster node, it functions.
  • Because additional nodes can be configured taking into account the load needs, this cluster offers reasonably priced scalability. 
  • If a node in this cluster experiences a problem, it will identify the issue and then distribute the necessary requests among the available nodes. This way, the node’s collapse won’t be observable from outside the cluster.

19. What us a storage cluster?

When a task is performed by a collection of two or more computers, those are known as clusters. The various clusters are mentioned as follows:

  • High availability
  • High performance
  • Load balancing 

The main features of the storage cluster are:

  • A storage cluster in particular offers a consistent and ideal view of the file systems on the servers included in the group. 
  • It enables servers to read from and write to a shared file system simultaneously.
  • Additionally, it enhances storage administration by streamlining and limiting the application installation and packaging process. 

20. How can you know which version of Red Hat are you using?

Using the ‘cat /etc/Redhat-release‘ command, you may find out the Red Hat version.

Red Hat Linux Interview Questions for Experienced Professionals

21. What is meant by hard links?

Hard links are only another term for existent files in the Linux operating system. We can create an infinite number of hard links for each file. They are capable of creating ties for other challenging connections. Hard links don’t reference the pathname; instead, they point to the actual file on the disc.

The ‘Is-I’ command can be used to count all of a file’s hard links.

If you’re wondering how to create hard links using command line, you can use the following command:

$ ln [original filename] [link name]

22. Can you name different types of Linux directory commands and explain each one of them?

There are 5 main types of Linux directory commands you can utilize to work with various files as well as directories. These commands are mentioned below:

  • cd: 

“Change directory” is referred to as “cd.” This command is used to switch the current working directory to the desired directory. This command’s syntax is $ cd path to new directory>.

  • pwd: 

The term “print working directory” (pwd) is used. This command shows the location of the active working directory. This command’s syntax is $ pwd.

  • mkdir: 

“Make directory” is what the acronym mkdir stands for. In Linux, we use this command to create folders.  This command’s syntax is $ mkdir name (and path, if necessary) of new directory>.

  • rmdir: 

“Remove directory” is what rmdir stands for. Any directory on the command line can be removed or deleted with this command. This command’s syntax is $ rmdir name (and path, if necessary) of directory.

  • Is: 

ls stands for “list”. To examine the whole list of files and directories in the currently open working directory, we use this command. This command’s syntax is $ ls.

23. Can you explain the process of creating LVM in Red Hat Cluster?

In order to create LVM in Red Hat Cluster, you can follow the steps mentioned:

  • Run the command “pvcreate /dev/sda2” (#pvcreate /dev/sda2) to achieve this.
  • Once the volume cluster has been built, the real volume must be added to it. 
  • Here, the command “vgcreate VLG0 /dev/sda2” (#vgcreate VLG0 /dev/sda2) could be used. 
  • From the volume cluster, create the required volume right away. 
  • Using the command “#lvcreate -L 1G -n LVM1 VLG0,” In the final stage, users must issue the “mke2f” command (#mke2fs -j /dev/VLG0/LVM1) to build a file system on Sda2.

24. What is meant by pwd command?

The pwd command stands for print working directory command. By using the ‘pwd’ command, you can print the full path name of the working directory right from the root. For example, 

/usr/bin/pwd is a pwd command.

25. What is meant by DASDs?

  • Expanded as Direct access storage devices (DASDs), these are either fixed or removable storage devices. 
  • Most commonly, DASDs are physical devices such as solid state disks or rotating disk drives.
  • DASDs are economical and easy to use. 
  • CD-ROM, DVD, and WORM (write-once read-many) are the types of devices that are not considered as DASDs and are not supported by Logical Volume Manager (LVM).

26. What are the type of remote software users you can use to encrypt the communication?

A dependable remote desktop platform known as the SSH can be used to encrypt the communication. It allows users to manage the Red Hat server without being physically present there. You can use various commands to control it.

27. What is meant by Virtual File Systems?

The v-node interface, sometimes referred to as the virtual file system (VFS) interface, serves as a link between the logical and physical file systems. 

The two main parts of the VFSs are as follows:

  • Logical file system: 

It provides support to the call interface of the system.

  • Physical file system:

It allows the user to manage permanent storage of the data.

So, in other words, the interface between the logical and physical file systems is called the virtual file system interface or the v-node interface. 

28. Can you name any 4 general password rules for a User account?

The important password rules for User account are mentioned below:

  • Include a total of at least eight characters.
  • You should employ a string in a novel way.
  • You must not frequently use birthdays and anniversaries.
  • Don’t overuse words that can be found in a dictionary.

29. How can you append one file with another?

The operator “>>” can be used to append a named file with another file. To append 2 files together, the following command can be used:
cat file 3 >> cat file 4

In order to append more than 2 files, you can use the following command line:

cat file 4 > cat file 5 > cat file 6

Notice how the operator “>” is used to append more than two files.

30. What are the main types of Linux shells?

Before knowing the different types of Linux shells, it is important to know what a shell is! A shell is a software that acts as a user interface. It connects the user with the Linux kernel. You can write instructions and programs in the shell in order to talk to the Linux kernel.

There are 5 types of shells in Linux:

  • CSH (C Shell)
  • BASH (Bourne Again Shell)
  • ZSH(Z Shell)
  • KSH (Korn Shell)
  • TCSH (Tenex C Shell)