If you are preparing for a Linux admin job interview then these basic Linux Interview Questions & Answers is definitely going to help you get the edge over the others. In this blog , we’ll try to cover a comprehensive list of Linux admin interview questions, ranging from basic to advanced, including L1, L2, L3, and scenario-based questions. So, let’s dive in and get started
Q1. What is the role of a Linux system administrator?
Ans : You may be asked this as what is daily role as a system administrator and you should be able to answers based on the below roles :
- Installing, configuring, and maintaining Linux systems
- Ensuring system security and implementing appropriate measures
- Managing user accounts and permissions
- Monitoring system performance and troubleshooting issues
- Creating and implementing backup and recovery plans
- Managing network services and protocols
- Installing and configuring system updates and patches
- Automating routine tasks and processes
- Maintaining system documentation and records.
Q2 : Could you please explain the Linux file system Hierarchy ?
Ans : The Linux file system hierarchy organizes files and directories in a inverted tree hierarchical manner. The hierarchy starts from the root directory and includes the following directories:
- /bin: contains essential executable binaries
- /boot: contains boot loader files
- /dev: contains device files
- /etc: contains system configuration files
- /home: contains user home directories
- /lib: contains shared libraries
- /mnt: used to mount temporary file systems
- /opt: contains optional software packages
- /proc: contains information about system processes
- /root: the home directory of the root user
- /sbin: contains system binaries
- /tmp: used to store temporary files
- /usr: contains user-related binaries, libraries, documentation, and source-code
- /var: contains variable data files like log files, mail queues, and print spools.
Q3 : Can you list some basic linux commands that you use in your daily task along with its uses ?
Ans : Some of the common Linux commands every administrator should know include:
- ls: to list files and directories
- cd: to change directories
- mkdir: to create a new directory
- rm: to remove files and directories
- cp: to copy files and directories
- mv: to move or rename files and directories
- chmod: to change file permissions
- chown: to change file ownership
- ps: to view active processes
- top: to view real-time system resource usage
- grep: to search for patterns in files
- ping: to test network connectivity
- ifconfig: to view network interface configurations.
Q4 : How Can you change the file permission & ownership in a Linux system ?
We can make use of the chmod command, while the chown command can be used for changing ownership. Let me explain how it will work
- chmod: This command is used to change the permissions of a file or directory. Permissions include read (r), write (w), and execute (x) for the owner, group, and others. You can use symbolic or numeric notation to set permissions. Examples:
chmod u+x myfile.txt # Add execute permission for the owner
chmod 755 myfile.txt # Set read, write, execute for the owner, and read, execute for group and others
- chown: This command is used to change the owner and/or group of a file or directory. The syntax is chown [owner]:[group] target. Examples:
chown user1 myfile.txt # Change the owner of myfile.txt to user1
chown user1:group1 myfile.txt # Change the owner to user1 and group to group1
Q5. Explain the process of creating and managing user accounts in Linux.
Ans : The creation and management of the user accounts in Linux involves the following steps:
- Create a new user: Use the useradd or adduser command to create a new user. For example:
useradd newuser
- Set a password: Use the passwd command to set a password for the new user. For example:
passwd newuser
- Modify user details: Use the usermod command to modify user details, such as the home directory or shell. For example:
usermod -d /new/home/dir newuser
- Delete a user: Use the userdel command to delete a user. For example:
userdel newuser
- Manage groups: Use the groupadd, groupmod, and groupdel commands to create, modify, and delete groups, respectively. You can also use gpasswd to manage group memberships.
Q6. What are the basic networking concepts a Linux admin should be aware of?
Ans : A Linux admin should be familiar with the following basic networking concepts:
- IP addressing and subnets
- Network interfaces and configuration files
- Routing and gateways
- Domain Name System (DNS)
- Network File System (NFS)
- DHCP server configuration
- Network troubleshooting tools, such as ping, traceroute, netstat, nslookup, tcpdump, and ifconfig
Q7. How do you install and update packages using a package manager in Linux?
Ans : Package managers are used to manage software packages in Linux. The most common package managers are apt for Debian-based distributions and yum or dnf for Red Hat-based distributions. Here are examples for each:
- Using apt:
sudo apt update # Update package list
sudo apt upgrade # Upgrade installed packages
sudo apt install package-name # Install a package
sudo apt remove package-name # Remove a package
- Using yum or dnf:
sudo yum update # Update package list and upgrade installed packages
sudo yum install package-name # Install a package
sudo yum remove package-name \# Remove a package
Q8. What are the steps to manage processes in Linux?
Ans : To manage processes in Linux, you can follow these steps:
- List processes: Use the ps command to list processes. Common options include -e for all processes and -u [user] for processes belonging to a specific user. For example:
ps -e # List all processes ps -u user1 # List processes for user1
- Monitor processes: Use the top or htop command to monitor processes in real-time. These tools provide a dynamic view of system processes and allow you to sort and filter the results.
- Search for a specific process: Use the pgrep command to search for processes based on their name or other attributes. For example:
- pgrep -u user1 program_name # Search for processes named program_name running by user1
- Send signals to processes: Use the kill command to send signals to processes. Common signals include SIGTERM (15) for a graceful shutdown and SIGKILL (9) for a forceful shutdown. For example:
kill -15 process_id # Send a SIGTERM signal to a process kill -9 process_id # Send a SIGKILL signal to a process
- Manage process priority: Use the nice and renice commands to set and modify the priority of processes. Lower nice values indicate higher priority. For example:
nice -n 5 program_name # Start a program with a nice value of 5 renice -n 10 process_id # Change the nice value of a process to 10
Q9. How do you troubleshoot common Linux issues?
Ans : Troubleshooting common Linux issues involves understanding the problem and using appropriate tools and techniques. Here are some steps:
- Check log files: Linux logs are stored in the /var/log directory. Check the relevant log files, such as syslog, dmesg, and messages, for error messages or other useful information.
- Use diagnostic commands: Use commands like ping, traceroute, netstat, nslookup, tcpdump, and ifconfig to diagnose network issues. For hardware issues, use dmesg, lshw, and lsblk.
- Monitor system resources: Monitor CPU, memory, disk, and network usage using tools like top, htop, vmstat, iostat, and iftop.
- Verify configuration files: Check configuration files for syntax errors and correct settings. Some applications provide built-in tools to test their configuration files (e.g., apachectl configtest for Apache web server).
- Restart services: Sometimes, restarting a service can fix an issue. Use systemctl or service commands to restart services (e.g., sudo systemctl restart apache2).
- Consult documentation and online resources: Refer to official documentation, online forums, and communities for additional guidance and solutions to common issues.
Q10: What are the basic components in Linux ?
Ans : The following are the basic components of Linux:
- Shell: It is a Linux interpreter which is used for executing commands.
- Kernel: Kernel is the core part of the operating system which is used to manage hardware and operations.
- System Utilities: These are the software functions which help users to manage their computers.
- GUI: GUI denotes Graphical User Interface through which the user can interact with the system. But unline CLI, GUI comprises buttons, images and TextBoxes for interaction.
- Application Programs: Software programs are designed to complete a particular task
Need any support on installing the Linux Operating System refer the previous Blog post How To install Rocky Linux 8
I would also request you to go through the Red hat Official Administrator guide for detailed preparations.