SYSTEM ADMIN INTERVIEW QUESTIONS 24-25
Table of Content
- Introduction
- File Permissions
- User and Group Management:
- Cron Jobs
- System Performance Monitoring
- Package Management (Red Hat)
- Conclusion
Introduction
The IT field is vast, and Linux is an important player, especially in cloud computing. This blog is written under the guidance of industry experts to help all tech and non-tech background individuals secure interviews for roles in the IT domain related to Red Hat Linux.
File Permissions
- Briefly explain how Linux file permissions work, and how you would change the permissions of a file using chmod.
In Linux, each file and directory has three types of permissions: read (r), write (w), and execute (x) for three categories of users: owner, group, and others.
Example: You will use chmod 744 filename, where the digits represent the permission in octal (7 = rwx, 4 = r–, etc.) to give full permission to the owner and read-only permission to groups and others. - What is the purpose of the umask command? How is it helpful to control default file permissions?
unmask sets the default permissions for newly created files and directories by subtracting from the full permissions (777 for directories and 666 for files).
Example: If you set the umask to 022, new files will have permissions of 644 (rw-r–r–), and directories will have 755 (rwxr-xr-x).
User and Group Management:
- Name the command that adds a new user in Linux and the command that is responsible for adding a user to a group.
The useradd command of Linux creates a new user while the sermod command adds a user to a specific group.
Example: Create a user called Jenny by sudo useradd jenny and add him to the developer’s group by sudo usermod—aG developers jenny, where the—aG option adds users to more groups without removing them from other groups.
- How do you view the groups that a user belongs to in Linux?
The group command in Linux helps to identify the group a user is a part of and is followed by the username.
Example: To check user John’s group: groups john
Cron Jobs
- What do you mean by cron jobs, and how is it scheduled to run a script every day at 2 AM?
A cron job is defined in a crontab file. Cron is a Linux utility to schedule tasks to run automatically at specified times.
Example: To schedule a script ( /home/user/backup.sh ) to run daily at 2 AM:
0 2 * * * /home/user/backup.sh
Where 0 means the minimum hour is 2, every day, every month, every day of the week. - How would you prevent cron job emails from being sent every time the job runs?
By default, cron sends an email with the output of the job. You can prevent this by redirecting the output to /dev/null.
Example: To run a script daily at 2 AM and discard its output:
0 2 * * * /home/user/backup.sh > /dev/null 2>&1
System Performance Monitoring
- How can you monitor system performance in Linux? Name some tools with their uses.
Some of the tools to monitor the performance are:
Top: Live view of system processes and usage of resources
htop: More user-friendly when compared to the top with an interactive interface.
vmstat: Displays information about processes, memory, paging, block IO, and
CPU usage.
iostat: Showcases Central Processing Unit (CPU) and I/O statistics for devices and partitions.
Example: You can use the top command ( top ) to identify processes consuming too much CPU or memory. - In Linux, how would you check the usage of disk space?
The df command checks disk space usage, and Du is responsible for checking the size of the directory/file.
Example: To check overall disk space usage: df -h
The -h option depicts the size in a human-readable format like GB, MB, etc. - How can you monitor system performance in Linux? Name some tools with their uses.
Some of the tools to monitor the performance are:
Top: Live view of system processes and usage of resource
htop: More user-friendly when compared to the top with an interactive interface.
vmstat: Displays information about processes, memory, paging, block IO, and
CPU usage.
iostat: Showcases Central Processing Unit (CPU) and I/O statistics for devices and partitions.
Example: You can use the top command ( top ) to identify processes consuming too much CPU or memory. - In Linux, how would you check the usage of disk space?
The df command checks disk space usage, and Du is responsible for checking the size of the directory/file.
Example: To check overall disk space usage: df -h
The -h option depicts the size in a human-readable format like GB, MB, etc.
Package Management (Red Hat)
9. How do you install, update, or remove packages in Red Hat-based Linux distributions by yum command?
In Red Hat and CentOS systems, the yum package manager is used to install, update, or remove software.
Install a package: sudo yum install httpd
This installs the Apache web server.
Update a package: sudo yum update httpd
Remove a package:sudo yum remove httpd
- By which command will you check the installation of a package on a Red Hat system?
The yum list installed command is required to check whether the package is installed.
Example: To check if httpd (Apache) is installed: yum list installed httpd
Conclusion
The questions are designed by our experienced corporate faculty which will help you to prepare well for various positions that require Linux such as System Admin.
No Comment