A Practical Guide to Fedora and Red Hat Enterprise Linux A
1. Linux Basics & System Setup
Q1. What command can you use to check the current version of RHEL or Fedora?
A1. You can use the command cat /etc/os-release
or hostnamectl
.
Q2. How do you check the system’s architecture?
A2. You can use the uname -m
command to check the system architecture.
Q3. What is the command to set the hostname on a RHEL/Fedora system?
A3. Use hostnamectl set-hostname <new-hostname>
.
Q4. Which file contains network configuration information in RHEL/Fedora?
A4. Network configuration files are located in /etc/sysconfig/network-scripts/
.
Q5. How do you configure the time zone in Fedora or RHEL?
A5. Use timedatectl set-timezone <timezone>
to set the time zone.
2. Package Management
Q6. What command is used to install a package in Fedora/RHEL?
A6. Use dnf install <package-name>
in Fedora or RHEL 8 and later, or yum install <package-name>
in earlier versions.
Q7. How do you update all installed packages on a Fedora/RHEL system?
A7. Use dnf update
to update all packages.
Q8. How do you remove a package in Fedora/RHEL?
A8. Use dnf remove <package-name>
to remove a package.
Q9. How can you list all installed packages?
A9. Use dnf list installed
to list installed packages.
Q10. What command would you use to search for a package?
A10. Use dnf search <package-name>
to search for a package.
3. System Services & Processes
Q11. How do you start a service in Fedora/RHEL?
A11. Use systemctl start <service-name>
to start a service.
Q12. How do you stop a service?
A12. Use systemctl stop <service-name>
to stop a service.
Q13. How can you check the status of a service?
A13. Use systemctl status <service-name>
to check the status.
Q14. How do you enable a service to start automatically on boot?
A14. Use systemctl enable <service-name>
to enable a service to start at boot.
Q15. How do you view a list of all active services?
A15. Use systemctl list-units --type=service
to view all active services.
4. User Management
Q16. How do you add a new user to the system?
A16. Use useradd <username>
to create a new user.
Q17. What command do you use to delete a user?
A17. Use userdel <username>
to delete a user.
Q18. How do you change a user’s password?
A18. Use passwd <username>
to change a user’s password.
Q19. How can you check the last login details of a user?
A19. Use lastlog
to view the last login details.
Q20. How do you lock a user’s account?
A20. Use passwd -l <username>
to lock the account.
5. File System & Storage Management
Q21. How do you list all mounted file systems in Fedora/RHEL?
A21. Use df -h
to list all mounted file systems.
Q22. How do you create a new directory in Linux?
A22. Use mkdir <directory-name>
to create a new directory.
Q23. How do you view the contents of a directory?
A23. Use ls <directory-path>
to view the contents of a directory.
Q24. How do you create a symbolic link to a file or directory?
A24. Use ln -s <target> <link>
to create a symbolic link.
Q25. What command would you use to check disk usage?
A25. Use du -sh <directory>
to check disk usage of a specific directory.
6. Networking
Q26. How can you display all network interfaces on a system?
A26. Use ip a
to display all network interfaces.
Q27. How do you configure a static IP address on Fedora/RHEL?
A27. Edit the file /etc/sysconfig/network-scripts/ifcfg-<interface-name>
and set BOOTPROTO=static
along with IPADDR=<ip-address>
, NETMASK=<netmask>
, and GATEWAY=<gateway>
.
Q28. How do you restart the network service?
A28. Use systemctl restart network
to restart the network service.
Q29. How do you check if a port is open on the system?
A29. Use ss -tuln
to list open ports.
Q30. How do you configure a firewall rule in RHEL/Fedora?
A30. Use firewall-cmd --add-port=<port>/tcp --permanent
to add a port to the firewall.
7. Security & SELinux
Q31. How do you check the status of SELinux?
A31. Use sestatus
to check the status of SELinux.
Q32. How can you temporarily disable SELinux?
A32. Edit /etc/selinux/config
and set SELINUX=disabled
or use setenforce 0
.
Q33. How do you enable SELinux permanently?
A33. Edit /etc/selinux/config
and set SELINUX=enforcing
.
Q34. How do you check the security context of a file?
A34. Use ls -Z <file>
to check the SELinux security context.
Q35. How do you add a user to the sudoers list?
A35. Edit the /etc/sudoers
file using visudo
and add the line <username> ALL=(ALL) ALL
.
8. Logs and Monitoring
Q36. What command can you use to view real-time logs?
A36. Use journalctl -f
to view real-time logs.
Q37. How do you view system logs in Fedora/RHEL?
A37. Use journalctl
to view system logs.
Q38. How do you monitor system resource usage in RHEL/Fedora?
A38. Use top
or htop
to monitor system resources.
Q39. How can you view CPU usage statistics?
A39. Use mpstat
or top
to monitor CPU usage.
Q40. How can you check the status of the disk space?
A40. Use df -h
to check disk space usage.
9. System Performance
Q41. What command can be used to identify the top processes consuming system resources?
A41. Use top
or htop
to see the processes consuming the most resources.
Q42. How do you find the system’s memory usage?
A42. Use free -h
to find memory usage.
Q43. How can you check the system load?
A43. Use uptime
or top
to check the system load.
10. System Recovery
Q44. What is the procedure to recover a system if the GRUB bootloader is corrupted?
A44. Boot from a live CD, chroot into the system, and reinstall or fix the GRUB bootloader using the grub2-install
and grub2-mkconfig
commands.
Q45. How do you recover the root password in RHEL/Fedora?
A45. Reboot the system into single-user mode and reset the root password using the passwd
command.
Linux Basics & System Setup
Q1. What command can you use to check the current version of RHEL or Fedora?
A1. cat /etc/os-release
or hostnamectl
.
Q2. How do you check the system’s architecture?
A2. uname -m
.
Q3. How do you configure the hostname on a RHEL/Fedora system?
A3. hostnamectl set-hostname <hostname>
.
Q4. Which file contains network configuration information in RHEL/Fedora?
A4. /etc/sysconfig/network-scripts/
.
Q5. How do you configure the time zone in Fedora or RHEL?
A5. timedatectl set-timezone <timezone>
.
Package Management
Q6. What command is used to install a package in Fedora/RHEL?
A6. dnf install <package-name>
or yum install <package-name>
for older versions.
Q7. How do you update all installed packages on a Fedora/RHEL system?
A7. dnf update
.
Q8. How do you remove a package in Fedora/RHEL?
A8. dnf remove <package-name>
.
Q9. How can you list all installed packages?
A9. dnf list installed
.
Q10. What command would you use to search for a package?
A10. dnf search <package-name>
.
System Services & Processes
Q11. How do you start a service in Fedora/RHEL?
A11. systemctl start <service-name>
.
Q12. How do you stop a service?
A12. systemctl stop <service-name>
.
Q13. How can you check the status of a service?
A13. systemctl status <service-name>
.
Q14. How do you enable a service to start automatically on boot?
A14. systemctl enable <service-name>
.
Q15. How do you view a list of all active services?
A15. systemctl list-units --type=service
.
Q16. How do you list all running processes on a system?
A16. ps aux
or top
.
Q17. How do you kill a process by its PID?
A17. kill <PID>
.
Q18. How do you suspend a running process?
A18. Press Ctrl+Z
to suspend and fg
to resume.
User Management
Q19. How do you add a new user to the system?
A19. useradd <username>
.
Q20. What command do you use to delete a user?
A20. userdel <username>
.
Q21. How do you change a user’s password?
A21. passwd <username>
.
Q22. How can you check the last login details of a user?
A22. lastlog
.
Q23. How do you lock a user’s account?
A23. passwd -l <username>
.
Q24. How do you add a user to the sudoers list?
A24. Edit /etc/sudoers
using visudo
and add the line <username> ALL=(ALL) ALL
.
Q25. How can you create a group in RHEL/Fedora?
A25. groupadd <groupname>
.
File System & Storage Management
Q26. How do you list all mounted file systems?
A26. df -h
.
Q27. How do you create a new directory in Linux?
A27. mkdir <directory-name>
.
Q28. How do you view the contents of a directory?
A28. ls <directory-path>
.
Q29. How do you create a symbolic link to a file or directory?
A29. ln -s <target> <link>
.
Q30. What command would you use to check disk usage?
A30. du -sh <directory>
.
Q31. How do you resize a partition in RHEL/Fedora?
A31. You can use tools like gparted
or parted
, but be cautious as this can affect data integrity.
Q32. How do you format a disk partition in RHEL/Fedora?
A32. mkfs.ext4 <device>
to format with ext4, or choose the relevant filesystem type.
Q33. How do you create a new logical volume in LVM?
A33. lvcreate -n <lv-name> -L <size> <volume-group>
.
Networking
Q34. How do you display all network interfaces on a system?
A34. ip a
or ifconfig
.
Q35. How do you configure a static IP address on Fedora/RHEL?
A35. Edit /etc/sysconfig/network-scripts/ifcfg-<interface-name>
and set BOOTPROTO=static
.
Q36. How do you restart the network service?
A36. systemctl restart network
.
Q37. How do you check if a port is open on the system?
A37. ss -tuln
or netstat -tuln
.
Q38. How do you configure a firewall rule in RHEL/Fedora?
A38. firewall-cmd --add-port=<port>/tcp --permanent
.
Q39. How do you set up a network bridge in RHEL/Fedora?
A39. Configure using nmcli
or edit the ifcfg-br<bridge-name>
file.
Q40. How do you test network connectivity to another host?
A40. Use ping <host>
.
Security & SELinux
Q41. How do you check the status of SELinux?
A41. sestatus
.
Q42. How can you temporarily disable SELinux?
A42. setenforce 0
.
Q43. How do you enable SELinux permanently?
A43. Edit /etc/selinux/config
and set SELINUX=enforcing
.
Q44. How do you check the security context of a file?
A44. ls -Z <file>
.
Q45. How can you enable or disable SELinux modules?
A45. Use semanage
command, e.g., semanage boolean --list
.
Q46. What command would you use to change the default security context of a file?
A46. chcon
.
Logs and Monitoring
Q47. What command can you use to view real-time logs?
A47. journalctl -f
.
Q48. How do you view system logs in Fedora/RHEL?
A48. journalctl
or view logs in /var/log/
.
Q49. How do you monitor system resource usage in RHEL/Fedora?
A49. top
or htop
.
Q50. How can you view CPU usage statistics?
A50. mpstat
or top
.
Q51. How can you check the status of the disk space?
A51. df -h
.
System Performance
Q52. What command can be used to identify the top processes consuming system resources?
A52. top
or htop
.
Q53. How do you find the system’s memory usage?
A53. free -h
.
Q54. How can you check the system load?
A54. uptime
or top
.
Q55. How do you measure disk I/O performance?
A55. iostat
or dstat
.
System Recovery
Q56. What is the procedure to recover a system if the GRUB bootloader is corrupted?
A56. Boot from a live CD, chroot into the system, and reinstall or fix the GRUB bootloader using grub2-install
and grub2-mkconfig
.
Q57. How do you recover the root password in RHEL/Fedora?
A57. Reboot into single-user mode and reset the root password using passwd
.
Q58. How do you mount a filesystem in RHEL/Fedora?
A58. mount <device> <mount-point>
.
GIPHY App Key not set. Please check settings