FRESHERS INTERVIEW Q&A

 In Q&A

1. What is sudo in Linux?
The word “sudo” is the short form of “Superuser Do” that allows you to run the command with system privileges. With this command, you can get the system’s administrative access to perform various tasks. The sudo command requires a password before the execution to verify the user’s authorization.

2. What is umask?
It is used for user file creation mode. When a user creates any file, then it has default file permission. Umask specifies restrictions for these permissions on the file, i.e., controls the permissions.

3. How to find and kill a process in Linux?
You can use different commands to kill a process, but first, you must find the PID of that specific process. So, please run the below command:
ps aux | grep
Once you get the PID of the process then run the kill command to end it:
kill
If you don’t want to find the PID, then you can use the pkill command to kill a process by its name:
pkill
The pkill command sends a signal (by default, SIGTERM) to the matched processes, causing them to terminate.

4. What is network bonding in Linux?
Network bonding is the process of creating a single network by combining two or more network interfaces. This combination of networks improves redundancy and performance by increasing bandwidth and throughput. The major benefit of network bonding is that the overall network works fine even if a single network in the bonding does not work properly.

5. What is SELinux?
SELinux or also known as Security-Enhanced Linux, is the security framework. It offers an additional layer of security to improve access control and strengthen security. SELinux was developed to improve the security policies to prevent unauthorized access and exploitation. However, learning about SELinux is essential before working on it can create serious security issues.

6. What is the purpose of the SSH protocol in Linux, and how do you securely connect to a remote server using SSH?
The Secure Shell (SSH) is a protocol in Linux which is used to establish a secure encrypted connection between a local and remote machine. It allows to securely access and manage remote servers. If we want to connect to a remote server using SSH. We can use the following command.
ssh username@remote_ip
Here replace the `username` with the desired username of the remote server and replace the `remote_ip` with the IP address of the remote server.

7. How do you check the contents of a file without opening it in Linux?
In Linux we can use the `cat` command to view the content of a file without opening it in an editor form.
For example: If we want to check content of a file with file_name = `geeks.txt`
cat geeks.txt

8. What is the purpose of the crontab file in Linux, and how do you schedule recurring tasks using cron jobs?
The crontab file in Linux is used to schedule recurring tasks or cron jobs. It contains a list of commands or scripts that are executed at specified time intervals. To edit the crontab file, you can use the crontab -e command.
For example: If we want to run a script name `jayesh.sh` every day at 5 AM, we can use the following procedure.
First, we need to open the crontab in editorial format.
crontab -e
Secondly, add the entries in the crontab fi
0 5 * * * /path/to/jayesh.sh

9. How do you find and replace text in a file using the sed command in Linux?
The sed command (stream editor) can be used to find and replace text in a file. The basic syntax is sed ‘s/pattern/replacement/g’ filename.
For example: to replace all occurrences of “true” with “False” in a file
sed ‘s/true/False/g’ file_name

10. What is the purpose of the sudoers file in Linux, and how do you configure sudo access for users?
The sudoers file in Linux controls the sudo access permissions for users. It determines which users are allowed to run commands with superuser (root) privileges. To configure sudo access, you can edit the sudoers file using the visudo command.
For example:
sudo visudo
Now add this line anywhere in the file. For instance, if we want to grant a user full sudo access.
user_name ALL=(ALL) ALL

11. How do you change the ownership of a file or directory in Linux using the chown command?
In Linux, you can change the ownership of a file or directory using the chown command. The basic syntax is chown new_owner: new_group filename.
For example: If we want to change the ownership of a file to user “Jayesh” and group “users”.
chown jayesh:users file_name

12. What is the purpose of the ping command in Linux, and how do you test network connectivity to a remote host?
Ping command is used to test the network connectively between the local and remote hosts. It basically sends an ICMP echo request packet to the remote host and waits for the corresponding echo reply packet.
For example: If we want to check the connectivity to a remote host, we use the following command.

ping remote_host_
Here replace `remote_host_ip` with the Ip address of the host

13. How do you recursively copy files and directories in Linux using the cp command?
In linxux we can simply use `-R` option with the `cp` command to recursively copy the file and directories.
For example:
cp -R sourece_durectory destination_directory

14. What is the purpose of the netstat command in Linux, and how do you view network connections and listening ports?
The netstat command in Linux is used to display active network connections, routing tables, and listening ports. To view network connections and listening ports, use the netstat command with appropriate options.
For example: If we want to display all listening TCP ports, we can use the following command.
netstat -tuln

15. How do you set up a static IP address in Linux using the command-line interface?
To set up a static IP address in Linux using the command-line interface, you need to modify the network configuration file. The location and name of the file may vary depending on the Linux distribution, but commonly it is /etc/network/interfaces. Open the file with a text editor and modify the configuration to set a static IP address, subnet mask, gateway, and DNS servers.
For example:
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
Save the file and restart the network service or reboot the system for the changes to take effect.

Recent Posts
Learn Devops

Become a Devops Engineer in 3 months