Your AI powered learning assistant

Linux 100 + Realtime Scenario Based Interview Questions and Answers Explained in Detail | Part - 1

Introduction

00:00:00

Linux is essential for various IT roles, including system administrators and DevOps engineers. The speaker shares over 100 scenario-based Linux interview questions gathered from personal experiences across different companies. Understanding Linux is crucial as it serves as the foundation for hosting applications on servers. This knowledge benefits both newcomers to the industry and those looking to advance their careers in technology.

How to set a username and password to never expires.

00:02:37

To set a username and password to never expire, use the command 'chage'. The syntax is 'chage -M -1 ', where '' can be any valid user name. This command modifies user account settings related to password expiration effectively.

Why /etc/passwd and /ete/shadow file cannot be merged into 1 file.

00:03:37

The /etc/passwd and /etc/shadow files serve distinct purposes in user information management. Merging them would compromise security, as the passwd file is readable by any application, potentially exposing sensitive data like hashed passwords to attackers. Keeping these files separate ensures that only root users can access the shadow file containing critical password hashes, thereby enhancing system security against unauthorized access.

To list, all the files opened by particular PID.

00:06:25

To list all open files associated with a specific process ID (PID), use the command 'lsof -p '. The 'lsof' command stands for 'list of open files', and the '-p' option specifies which PID to query. This allows you to see all files currently opened by that particular process, providing insight into its activity.

We are unable to unmount the file system. What are the reason behind it ?.

00:07:11

Unmounting a file system can fail for several reasons. First, if you are currently in the directory you're trying to unmount, you'll need to navigate out of it using 'PWD'. Second, other users may be accessing files within that directory; use commands like 'fuser -c' and 'fuser -u' followed by the partition name (e.g., /dev/sda) to identify them. Lastly, open files in that directory will prevent unmounting; check with 'lsof' followed by the partition name to list these active connections.

What could be the reason it server take more time after reboot?.

00:09:15

A server may take longer to reboot due to file system corruption, which is a critical concern for Linux administrators. If the file system, such as EXT2, EXT3, or XFS becomes corrupted during operation and lacks journaling features—common in older versions like Red Hat 4 or 5—it can significantly delay recovery processes. Modern filesystems have improved capabilities that allow for better data integrity and quicker recovery from issues compared to earlier systems without these enhancements.

we are trying to create the file under any partition but we are getting permission denied alert. What could be the reason? However space issue and no permission issue?

00:10:58

When attempting to create a file in any partition, receiving a 'permission denied' alert can be confusing. The common assumption is that it relates to user permissions or disk space; however, the actual issue often lies with running out of inodes. To diagnose this problem, use the command `df -i` which displays inode usage for filesystems. If all available inodes are consumed despite having free disk space, it's essential to identify and remove unwanted files or transfer them elsewhere.

How to check kernel routing table Information?

00:15:04

To check kernel routing table information in Linux, three primary commands can be used: `route -n`, `netstat -rn`, and `ip route`. Each command provides insights into the current routing configuration of the system. Understanding these commands is crucial for effective network troubleshooting and management.

How to set sticky bit and what is the difference b/w smalls and capital S

00:16:27

The sticky bit is a special permission applied to files or directories, allowing only the owner and root user to delete them. Even if others have full permissions, they cannot remove these items when the sticky bit is set. To configure this permission, you can use either symbolic (chmod o+t) or numerical methods (chmod 1757). The small 's' indicates that a file has both setuid and executable permissions while capital 'S' signifies setuid without execute rights.