Top 150+ Frequently Asked Linux Interview Questions Answers

  • By Gandhar Bodas
  • October 26, 2024
  • Linux
Top 150+ Frequently Asked Linux Interview Questions Answers

Top 150+ Frequently Asked Linux Interview Questions Answers

Explore the top 150+ frequently asked Linux interview questions answers to prepare effectively for your next job interview and boost your Linux skills.

 

1. What is Linux

Ans 

Linux is an open-source operating system kernel used for a variety of computing devices, such as servers, desktops, mobile phones, and embedded systems. 

 

2. Explain the difference between UNIX and Linux.  

Ans 

Linux is a Unix-like operating system, but there are differences. UNIX is a proprietary operating system, while Linux is open source. Linux is a clone of the UNIX operating system. 

 

3. Advantages of Linux OS? 

Ans 

Fast  

Free 

open source 

community support  

network friendly  

stability in performance  

high security 

customizable 

work low hardware resource

 

4. What is the root account in Linux?  

Ans 

The root account, also known as the superuser or administrator, has elevated privileges and can execute commands with unrestricted access to the system. 

 

5. How do you change permissions in Linux?  

Ans 

The chmod command is used to change file permissions in Linux. 

 

6. Explain the use of the grep command.  

Ans 

The grep command is used to search for a specific pattern or text in a file. It can be used with regular expressions for more complex searches. 

 

7. What is the purpose of the ls command?  

Ans 

The ls command is used to list files and directories in a directory 

 

8. How do you find information about a command in Linux?  

Ans 

The man command is used to display the manual pages for a given command. For example, man ls displays the manual page for the ls command. 

9. Explain the purpose of the /etc/passwd file.  

Ans 

The /etc/passwd file contains user account information, including usernames, user IDs, home directories, and default shells. 

 

10. Which programming language was used to develop the Linux kernel?  

Ans 

The Linux kernel is primarily written in the C programming language

 

11. Who created Linux, and when was it first released?  

Ans 

Linux was created by Linus Torvalds, and the first version (0.01) was released in September 1991.

 

12. What is the ls command used for?  

Ans 

The ls command is used to list files and directories in a directory. 

 

13. Explain the purpose of the cp command.  

Ans 

The cp command is used to copy files or directories. For example, cp file1.txt /destination copies  “file1.txt” to the specified destination. 

 

14. How do you move a file in Linux? 

Ans:- The mv command is used to move files or directories. For example, mv file1.txt /destination moves “file1.txt” to the specified destination. 

 

15. What is the function of the rm command?  

Ans 

The rm command is used to remove or delete files and directories. For example, rm file1.txt  deletes “file1.txt.” 

 

14. How do you create a new directory in Linux?  

Ans 

The mkdir command is used to create a new directory. For example, mkdir new_directory creates a  directory named “new_directory.” 

 

15. What is the purpose of the pwd command?  

Ans 

The pwd command stands for “print working directory” and is used to display the current working directory. 

 

16. How do you navigate to the home directory quickly?  

Ans 

The cd command with no arguments or with the tilde (cd ~) is used to navigate to the home directory.

 

17. Explain the use of the man command.  

Ans 

The man command is used to display the manual pages for other commands. For example, man ls shows the manual page for the ls command. 

 

18. How can you find out who is currently logged into the system?  

Ans 

The who command is used to display information about users who are currently logged in. 

 

19. What is the purpose of the cat command?  

Ans 

The cat command is used to concatenate and display the content of files. For example, cat file.txt  displays the content of “file.txt.” 

 

20. How do you add a new user in Linux?  

Ans 

The useradd command is used to add a new user. For example, useradd newuser creates a new  user named “newuser.” 

21. Explain the purpose of the /etc/passwd file.  

Ans 

The /etc/passwd file contains user account information, including usernames, user IDs(UIDs),  home directories, and default shells. 

22. How do you change the password for a user in Linux?  

Ans 

The passwd command is used to change the password for a user. For example, passwd username allows the user “username” to change their password. 

23. What is the function of the /etc/shadow file?  

Ans 

The /etc/shadow file stores encrypted password information for user accounts, providing an additional layer of security over the /etc/passwd file. 

 

24. How can you view the groups to which a user belongs? 

Ans- 

#grep <name of group> /etc/group 

or 

#cat /etc/group 

 

25. How do you add a user to a group in Linux?  

Ans- 

#gpasswd -a <user> <group> 

 

26. What is the purpose of the /etc/group file?  

Ans 

The /etc/group file contains group information, including group names, group IDs (GIDs), and the list of users who belong to each group.

 

27. How do you create a new group in Linux?  

Ans 

The groupadd command is used to create a new group. For example, groupadd newgroup creates a  new group named “newgroup.” 

 

28. Explain the difference between the id and whoami commands.  

Ans 

The id command provides more detailed information about the user, including user and group IDs and group memberships. 

The whoami command simply prints the username of the current user. 

 

29. How can you delete a user in Linux?  

Ans 

The userdel command is used to delete a user. 

 

30. What is the purpose of the chown command?  

Ans 

The chown command is used to change the ownership of files or directories. For example, chown  username:groupname file changes the owner to “username” and the group to “groupname.”

 

31. How do you change the group ownership of file/dir?  

Ans- 

#chgrp <name of group> <name of file/dir>

  1. Explain the purpose of the su command.  

Ans 

The su command is used to switch to another user account. It can be used with the – option to simulate a full login, updating the user’s environment variables. 

 

33. How do Change the Permissions of a File or Directory?  

Ans 

The chmod command is the command that modifies the permissions of a file or directory. 

 

34. Explain 750 permission  

Ans: 

rwx r-x — 

 

35. what is the use of uptime command  

Ans 

Uptime command show computer uptime 

 

36. How to check kernel version in Linux  

Ans: 

#uname -r 

 

37. What is a regular expression (regex)?  

Ans 

A regular expression is a sequence of characters that defines a search pattern. It is a powerful tool for pattern matching and text manipulation. 

 

38. How do you use the grep command with regular expressions in Linux?  

Ans 

The grep command is used to search for patterns in text files. For example, grep ‘pattern’ file.txt  searches for the specified pattern in “file.txt.” 

 

39. What is the purpose of the find command in Linux?  

Ans 

The find command is used to search for files and directories in a directory hierarchy based on various criteria.

 

40. How do you use the find command to search for a file by name?  

Ans 

The basic syntax isfind <directory> -name <filename>. For example, find /home/user -name  example.txt searches for a file named “example.txt” in the “/home/user” directory. 

 

41. what is the use of the tar command  

Ans 

tar stands for Tap Archive, tar command uses for create and extracting Archive files using algorithms such as gzip,bzip2,xzip etc. 

 

42. What is Vim? 

Ans 

Vim (Vi Improved) is a highly configurable and efficient text editor that is an improved version of the traditional Vi editor. 

 

43. How do you enter and exit Vim?  

Ans 

To enter Vim, you can open a terminal and type vim followed by the name of the file you want to edit. To exit Vim, press Esc to enter command mode and then type :wq to save and quit, or :q! to  quit without saving changes. 

 

44. Explain the difference between command mode and insert mode in Vim. 

Ans 

In command mode, you can navigate, delete, copy, and perform other actions using keyboard commands. In insert mode, you can actually insert and edit text. 

 

45. How do you switch from command mode to insert mode in Vim?  

Ans 

Pressi in command mode to enter insert mode 

 

46. What is the purpose of the :w command in Vim?  

Ans 

The:w command is used to save changes to the file without exiting Vim.

 

47. Explain the purpose of the :q command in Vim.  

Ans 

The:q command is used to quit Vim. If changes were made to the file, Vim will not allow you to quit unless the changes are saved. 

 

48. How can you save changes and quit Vim in a single command?  

Ans 

You can use the :wq command to save changes and quit Vim simultaneously. 

 

49. How can you quit Vim without making changes?  

Ans 

In command mode, you can use the :q! command to force quit without saving changes. 

 

50. What is the purpose of the dd command in Vim?  

Ans 

The dd command is used to delete the entire line on which the cursor is positioned. 

 

51. Explain the purpose of the p command in Vim.  

Ans 

The p command is used to paste the content that was yanked or deleted. It pastes after the cursor position in command mode. 

 

52. Explain the linux directory hierarchy(structure) in Linux.  

Ans 

Linux follows a hierarchical file system structure. The root directory is denoted by “/”, and subdirectories branch out from it, forming the file system hierarchy. 

 

53. how to check basic file permission of file or directory  

Ans- 

#ls-l note.txt  

#ls -ld /india 

 

54. What is GRUB?  

Ans 

GRUB (Grand Unified Bootloader) is a bootloader from the GNU project. It’s a program that is responsible for managing the boot process.

 

55. What is GUI?  

Ans 

GUI is an acronym for Graphical User Interface. These are the graphical elements of a Linux operating system which include windows, icons, menus, buttons, taskbars, and much more. 

 

56. What is CLI?  

Ans 

CLI is an acronym for Command Line Interface. This is an interface that allows users to type commands on a shell provided by the terminal. 

 

57. how to show hidden files in Linux  

Ans 

with the help of the following command  

#ls -a 

 

58. What is the purpose of the command in Linux?  

Ans 

The at command is used to schedule one-time tasks to be executed at a specific time in the future. 

 

62. How do you use the command to schedule a task?  

Ans 

You can use the at command followed by the time and date when you want the task to run, and then enter the command or script you want to execute. For example, at 3pm tomorrow and then provide the command. 

 

63. Explain how to view the list of scheduled at jobs.  

Ans 

The atq command is used to display the list of at jobsin the queue. 

 

64. How do you remove a schedule at job?  

Ans 

The atrm command, followed by the job number (obtained from atq), is used to remove a  scheduled at job.

 

65. What is the difference between at and cron?  

Ans 

The at command is used for one-time scheduling, while cron is a more flexible and recurring task scheduler. 

 

66. What is cron in Linux?  

Ans 

cron is a time-based job scheduler in Unix-like operating systems. It allows usersto schedule tasks  (cron jobs) to run periodically at fixed times, dates, or intervals. 

 

67. How do you edit the crontab file for a specific user?  

Ans 

The crontab -e command opens the crontab file for editing. It allows users to schedule or modify  their own cron jobs. 

 

68. Explain the format of a cron job entry.  

Ans 

A cron job entry consists of five fields representing the minute, hour, day of the month, month,  and day of the week when the job should run. An example entry might look like 0 2 * * * (runs daily at 2:00 AM). 

 

69. Explain how to schedule a cron job to run every weekday at 4:30 PM.  

Ans 

The cron entry 30 16 * * 1-5 schedules a job to run at 4:30 PM every weekday (Monday to Friday). 

 

70. How can you view the system’s cron logs?  

Ans 

The cron logs are typically stored in /var/log/cron or /var/log/syslog, and you can use commands like cat or tail to view the contents. 

 

71. what is use of head command?  

Ans 

to show top 10 line of the file 

 

72. what is the use of the tail command?  

Ans 

to show bottom 10 line of the file

 

73. what is the use of wc command?  

Ans 

wc show word count,line count and character counting. 

 

74. What is a disk partition in Linux?  

Ans 

A disk partition is a logical division of a physical disk drive. It allows the disk to be treated as separate units, each with its own file system. 

 

75. Explain the difference between primary and extended partitions.  

Ans 

Primary partitions are the main partitions on a disk, and there can be up to four of them. Extended partitions are used to create additional logical partitions beyond the limit of four primary partitions. 

 

76. How can you view the existing partitions on a Linux system?  

Ans 

The fdisk -l command displays information about all disks and partitions on the system. 

 

77. How do you format a partition in Linux?  

Ans 

The mkfs command is used to format a partition with a specific file system. For example, mkfs.ext4 /dev/sdX1 formats the partition at /dev/sdX1 with the ext4 file system. 

 

78. Explain the use of the mount command in Linux.  

Ans 

The mount command is used to attach a file system to a specific directory, making the files within that file system accessible. 

 

79. How can you make a partition automatically mount at boot?  

Ans 

You can add an entry to the /etc/fstab file to specify the details of the partition, including the mount point and file system type. 

 

80. What is the purpose of the swap partition in Linux?  

Ans 

The swap partition is used as virtual memory in Linux. It helps the system handle situations where 

physical memory (RAM) is insufficient by temporarily moving data from RAM to the swap space on the disk. 

 

81. How do you resize a partition in Linux?  

Ans 

The resize2fs command is used to resize the file system, and toolslike parted or gparted can be used to resize the actual partition. 

 

82. Explain the significance of the root (/) partition in Linux.  

Ans 

The root partition contains the root file system and is essential for the proper functioning of the operating system. It includes the system files and directories required for booting. 

 

83. What is LVM (Logical Volume Management) in Linux?  

Ans 

LVM is a system of managing logical volumes, allowing for dynamic resizing and easy management of file systems across physical disks. 

 

84. How can you check disk space usage in Linux?  

Ans 

The df, lsblk and du command is used to display information usage 

 

85. What is LVM (Logical Volume Management) in Linux? 

Ans 

LVM is a logical volume manager for the Linux kernel that provides a flexible and dynamic way to  manage storage by creating logical volumes from physical storage devices. 

 

86. Explain the components of LVM.  

Ans 

LVM consists of Physical Volumes(PVs), Volume Groups(VGs), and Logical Volumes(LVs). Physical  Volumes are individual storage devices, Volume Groups group together one or more Physical  Volumes and Logical Volumes are created within Volume Groups. 

 

87. How do you initialize a disk as a Physical Volume (PV) in LVM?  

Ans 

The pvcreate command is used to initialize a disk as a Physical Volume. For example, pvcreate /dev/sdb initializesthe disk at /dev/sdb as a Physical Volume.

 

88. Explain the purpose of a Volume Group (VG) in LVM.  

Ans 

A Volume Group is a collection of one or more Physical Volumes. Itserves as a pool of storage from  which Logical Volumes can be created. 

 

89. How can you create a Volume Group in LVM?  

Ans 

The vgcreate command is used to create a Volume Group. For example, vgcreate myvg /dev/sdb creates a Volume Group named “myvg” using the Physical Volume /dev/sdb. 

 

90. How do you extend a Volume Group in LVM?  

Ans 

The vgextend command is used to add additional Physical Volumesto an existing Volume Group.  For example, vgextend myvg /dev/sdc adds /dev/sdc to the “myvg” Volume Group. 

 

91. What is a Logical Volume (LV) in LVM?  

Ans 

A Logical Volume is a virtual partition created within a Volume Group. It is used to allocate space from the Volume Group to store data. 

 

92. How can you create a Logical Volume in LVM?  

Ans 

The lvcreate command is used to create a Logical Volume. For example, lvcreate -L 10G -n mylv  myvg creates a Logical Volume named “mylv” with a size of 10GB in the “myvg” Volume Group. 

 

93. Explain the process of resizing a Logical Volume in LVM.  

Ans 

To resize a Logical Volume, you can use the lvresize command. For example, lvresize -L +5G  myvg/mylv increases the size of “mylv” by 5GB. 

 

94. How can you resize a file system on a Logical Volume after resizing the LV?  

Ans 

The resize2fs command is used to resize ext2, ext3, or ext4 file systems. For example, resize2fs /dev/myvg/mylv resizesthe file system on the “mylv” Logical Volume.

 

95. What are the different types of file systems supported in Linux?

Ans 

The Linux-supported file systems are ext2, ext3, ext4, xfs, vfat etc. 

 

96. Explain the difference between swap space and RAM.  

Ans 

RAM (Random Access Memory) is volatile memory that stores data and programs currently in use  by the operating system and applications. Swap space, on the other hand, is non-volatile storage  used as an extension of RAM when the physical memory is full. 

 

97. What is the purpose of the mkswap command?  

Ans 

The mkswap command is used to initialize a device or file asswap space. For example, mkswap /dev/sdX1 initializesthe swap partition at /dev/sdX1. 

 

98. What is the purpose of the swapon command?  

Ans 

The swapon command is used to activate swap devices or files. For example,swapon /dev/sdX1  activates the swap partition at /dev/sdX1. 

 

99. How can you temporarily disable swap space in Linux?  

Ans 

The swapoff command is used to disable swap space. For example,swapoff /dev/sdX1 disablesthe  swap partition at /dev/sdX1. 

 

100. What isswap space in Linux?  

Ans 

Swap space is a dedicated area on a storage device (usually a hard disk) that is used as virtual memory by the operating system when physical RAM is fully utilized. 

 

101. When and why is swap space used?  

Ans 

Swap space is used when the system’s physical RAM is exhausted. It acts as an extension of RAM,  allowing the system to temporarily move inactive or less frequently used data from RAM to the  swap space.

 

102. How can you check the amount of swap space in Linux?  

Ans 

The free -m & free -h command displays information about both physical RAM and swap space.  Specifically, the swap section shows the total, used, and free swap space. 

 

103. Explain the role of the bootloader in the Linux boot process.  

Ans 

This question assesses the candidate’s knowledge of how the bootloader (e.g., GRUB) facilitates the loading of the kernel. 

 

104. What is the kernel, and what is its role in the boot sequence?  

Ans 

This question helps gauge the candidate’s understanding of the kernel’s function during the boot process, including hardware initialization. 

 

105. Totalrunlevel in rhel9 linux?  

Ans 

7 Runlevel 

 

106. Explain boot process linux  

Ans 

Power ON – POST – MBR – Grub – Kernel – Systemd – Login 

 

107. Tell me 7 runlevel Sequencialy  

Ans: 

RunLevel 0 – Poweroff.target  

RunLevel 1 – rescue.target 

RunLevel 2 – multi-user.target  

RunLevel 3 – multi-user.target  

RunLevel 4 – Not in use 

RunLevel 5 – graphical.target  

RunLevel 6 – reboot.target 

 

108. How to check the default run level in Linux  

Ans- 

#systemctl get-default

 

109. How to set default run level in Linux  

Ans- 

#systemctlset-default <name of run level> 

 

110. which command used for check ip address in linux  

Ans- 

#ifconfig  

or 

#ip addr 

 

111. which command use for IP address linux  

Ans: 

#nmtui  

#nmcli 

 

112. How to check the available network connection list in linux 

Ans- 

#nmcli con show 

 

113. How to down and up network connection?  

Ans- 

#nmcli con up enp0s3  

#nmcli con down enp0s3 

 

114. What is use ofssh?  

Ans 

ssh use for access remote computers by using the command line interface. 

 

115. what is the default port number ofssh?  

Ans 

 

116. Difference between telnet and ssh  

Ans 

Telent transfer information in plain text between local to remote syste,ssh transfers information in encrypted format between local to remote system. 

telnet use port number 23,ssh use port number 22 

 

117. what is use ofssh-keygen  

Ans: 

ssh-keygen use for generated private and public key for keybase remote authentication. 

 

118. How to protect authorized access of single user mode?  

Ans 

by using grub password. 

 

119. what is path of grub configurtion file in linux  

Ans- 

#vim /etc/grub2.cfg 

 

120. Tell me ssh command for access remote computer  

Ans- 

#ssh <user name>@<computer ip/name>  

#ssh root@192.168.1.3 

 

121 How to check status of httpd service  

Ans- 

#systemctl status sshd 

 

122. How to start, stop,enable, disable sshd service?  

Ans- 

#systemctlstartsshd  

#systemctl stop sshd 

#systemctl enable sshd  

#systemctl disable sshd

 

123. which command use for remote file transfer in linux  

Ans- 

#scp ( secure copy ) 

#rsync ( Remote Synchronization ) 

 

124. How to check the firewall default zone?  

Ans- 

#firewall-cmd –get-default 

 

125. How to set the firewall default zone? 

Ans- 

#firewall-cmd –set-default-zone=<zone name> 

 

126. How to add a port in the firewall  

Ans- 

#firewall-cmd –permanent –add-port=<port number/(tcp/udp> 

 

127. How to remove service from the firewall 

#firewall-cmd –permanent –remove-service=<name of service> 

 

128. What is a Yum Server?  

Ans 

Yum (Yellowdog Update Modifier) is an open-source management tool for Red Hat Packet Manager-based Linux systems. It allows users and administrators of a system to install, update, remove or search packages easily. 

 

129. How to install package in linux with help of yum command?  

Ans: 

#yum install <name of package> 

 

130. How to check package is installed or not?  

Ans- 

#yum info <name of package>

 

131. What are NFS usages?  

Ans 

NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files. 

 

132. NFS default port number?  

Ans 

2049 

NFS configuration file?  

Ans- 

/etc/nfs-exports 

 

133. What is the full form of DHCP?  

Ans 

The full form of DHCP is Dynamic Host Configuration Protocol

134. What does DHCP do? 

Ans 

Dynamic Host Configuration Protocol: Assigns IP addresses to clients on a dynamic or automatic basis. 

 

135. What is the scope of DHCP?  

Ans 

The scope is basically the range of IP addresses that is assigned to DHCP clients. 

 

136. What do you mean by an IP Lease?  

Ans 

The DHCP server assigns the client an IP address for a time period of 8 days. We call this offer an IP  Lease. 

 

137. What exactly is Reservation?  

Ans 

IP Reservation means reserving a specific dynamic IP address for a certain system. When you use the DHCP IP reservation, you basically instruct your Wi-Fi network to assign the same IP address to a specific device each time it connects to your network.

 

138. Which ports do DHCP, and the DHCP clients use?  

Ans 

For requests, UDP Port 68 is used, and for server responses, UDP Port 67 is used. 

 

139. Why is Dora process used in DHCP?  

Ans 

DORA stands for Discover, Offer, Request, Acknowledge. DHCP uses the Dora Process to provide an IP  Address to hosts or client machines. 

 

140. Configuration file of samba?  

Ans- 

/etc/samba/smb.conf 

 

141. What is MariaDB?  

Ans 

MariaDB is a community-based, open-source project developed by MySQL developers, providing similar features to MySQL. 

It is a relational database management system used for a wide range of applications, from banking to websites. 

MariaDB offers fast, scalable, and robust performance, making it a versatile solution for various use cases. 

 

142. What is the difference between MariaDB and MySQL?  

Ans 

MariaDB is a fork of MySQL, meaning that it is based on the same codebase as MySQL. However,  MariaDB has additional features and improvements that are not found in MySQL. 

 

143. What are the advantages of using MariaDB?  

Ans 

Some of the advantages of using MariaDB include improved performance, increased scalability,  and enhanced security features. 

 

144. How do you create a user account in MariaDB?  

Ans 

To create a user account in MariaDB, you can use the following syntax:  

CREATE USER ‘username’@’localhost’ IDENTIFIED BY ‘password’;

 

145. How do you create a database in MariaDB?  

Ans 

To create a database in MariaDB, you can use the CREATE DATABASE statement. 

 

146. How do you create a table in MariaDB?  

Ans 

To create a table in MariaDB, you can use the CREATE TABLE statement. 

 

147. Which script is used to secure mariadb in rhel9?  

Ans 

mysql_secure_installation 

 

148. What is the purpose of the GRANT statement in MariaDB?  

Ans 

The GRANT statement in MariaDB is used to grant privileges to users or roles 

 

149. What do you mean by Apache Web Server?  

Ans 

Apache web server is the HTTP web server that is open source, and it is used for hosting the website. 

 

150. How to check the Apache version?  

Ans 

You can use the command httpd -v 

 

151. What is the port of HTTP and https of Apache?  

Ans 

The port of HTTP is 80, and https is 443 in Apache. 

 

152. How will you install the Apache server on a Linux Machine? 

Ans 

We can give the following command for Centos and Debian, respectively:  Centos/RHEL: yum install httpd 

Debian: apt-get install apache2.

 

153. How you will check the httpd.conf file syntax error?  

Ans: 

#httpd -t 

 

154. What is Virtual Hosting?  

Ans 

Virtual Hosting in Apache allows you to host multiple websites on a single instance. 

 

155. What is DocumentRoot?  

Ans 

DocumentRoot directive is the configuration where you can specify the folder location from where the static files will be served. It’s also called WebRoot. 

The default DocumentRoot location is /var/www/html 

 

156. What are the benefits of NIC Teaming?  

Ans 

Fault Tolerance  

Failover 

 

157. What is the use of /etc/hosts file? 

Ans 

To map any hostname to its relevant IP 

 

158. What is Ansible?  

Ans 

Ansible is a configuration managementsystem. It is used to set up and manage infrastructure and applications. It allows users to deploy and update applications using SSH without the need to install an agent on a remote system. 

 

159. What isthe use of Ansible?  

Ans 

Ansible is used for managing IT infrastructure and deploying software apps to remote nodes. Ansible allows you to deploy an application to many nodes with one single command. However,  for this, we need some programming knowledge to understand the Ansible scripts.

 

160. What is a playbook?  

Ans 

A playbook has a series of YAML-based files that send commands to remote computers via scripts. 

 

161. What is a YAML file and how do we use it in Ansible?  

Ans 

YAML files are like any formatted text file, with a few sets of rules similar to those of JSON or XML.  Ansible uses this syntax for playbooks as it is more readable than other formats. 

 

162. Explain Ansible facts.  

Ans 

Ansible facts can be thought of as a way for Ansible to get information about a host and store it in variables for easy access. This information, which is stored in predefined variables, is available for use in the playbook. To generate facts, Ansible runs the set-up module. 

 

163. What is an Ansible vault?  

Ans 

Ansible vault is used to keep sensitive data, like passwords, rather than placing it as plain text in playbooks or roles. Any structured data file or single value inside a YAML file can be encrypted by  Ansible. 

 

164. What is the Ansible Galaxy?  

Ans 

Galaxy is a website that lets Ansible users share their roles and modules. The Ansible Galaxy command line tool comes packed with Ansible, and it can be used to install roles from Galaxy or directly from a Source Control Management system. 

 

165. What are the variables in Ansible?  

Ans 

Variables in Ansible are very similar to variables in any programming language. Just like any other variable, an Ansible variable is assigned a value that is used in computing playbooks. 

 

166. How to create encrypted files using Ansible?  

Ans 

To create an encrypted file, use the ‘ansible-vault create’ command and pass the filename.  #ansible-vault create filename.yaml

 

167. Is Ansible an Open Source tool?  

Ans 

Yes, Ansible is open source. That means you take the modules and rewrite them. Ansible is an open-source automated engine that lets you automate apps. 

 

168. What are handlers?  

Ans 

In Ansible, handlers are just like normal tasks in a playbook but run when tasks include the notify directive and also indicate that it changed something. It runs only once after all the tasks executed in a particular play. It automatically loads through roles/<role_name>/handlers/main.yaml. 

 

169. Do you know what language Ansible is written in?  

Ans 

Ansible is written in Python and PowerShell. 

 

170. Please explain what is Red Hat Ansible.  

Ans 

Ansible provides end to end-to-complete automation platforms that are capable of providing the  following features or functionalities: 

Provisioning 

Deploying applications  

Orchestrating workflows  

Manage IT systems  

Configuration of IT systems  

Networks 

Applications. 

 

171. Why do you have to learn Ansible?  

Ans 

Ansible is a powerful open-source software configuration management tool for managing Remote  Servers, Cloud Infrastructure, cross-platform OS, Networking devices, etc. 

 

172. Explain the Ansible register variable.  

Ans 

An ansible register is used to store the output from task execution in a variable.

 

To explore more do visit: Click Here

 

Author:-

Gandhar Bodas

Call the Trainer and Book your free demo Class For Linux Call now!!!
| SevenMentor Pvt Ltd.

© Copyright 2021 | SevenMentor Pvt Ltd.

Submit Comment

Your email address will not be published. Required fields are marked *

*
*