Foreword

The aim of this guide is to provide the quickest path possible towards passing the LFCS exam. The way you are evaluated in this exam is based on practical exercises, so that’s where I put the focus on with these guides.

If you are a newcomer to Linux, I beg you to not stop here, Operating Systems is an amazing subject. Its history is full of bright engineers who came up with clever solutions that you use on your day to day life. Take a full dive on other articles about the concepts these commands use here.

Learning objectives

Learning GoalCommand
Boot, reboot, and shut down a system safelyshutdown
Boot or change system into different operating modes`systemctl isolate
Install, configure and troubleshoot bootloader`grub2-[install
Manage the startup process and servicessystemctl /etc/systemd/system/ UNIT-files format
Diagnose and manage processesps /proc kill `p(grep
Verify the integrity & availability of key processesSame as above + systemctl status process
Locate and analyze system log files/var/log/ /etc/rsyslog.conf /etc/logrotate.conf
Schedule tasks to run at a set date and timecrond /etc/cron.d anacron at
Use scripting to automate system maintenance tasksBASH + crond
Verify completion of scheduled jobs/var/log/cron
Verify the integrity & availability of resourcesrpm -V
Change kernel runtime parameters, (non-)persistent/etc/sysctl.conf /etc/sysctl.d sysctl
Manage Software`dnf [info
Update software packagesdnf check-updates dnf update
Identify the package that a file belongs torpm -qf
Identify SELinux/AppArmor file and process contexts-Z chcon restorecon semanage `audit2[allow

Review questions

  1. Switch the current run-level to the multi-user level
  2. make the previous change persistant
  3. make this change persistant through the bootloader
  4. Install GRUB bootloader on a new partition
  5. Make a configuration change and re-install the bootloader
  6. Find out if a service is running
  7. Create a ls service that uses netcat to listen for connections on a choosen port
  8. Make this new service to start on boot
  9. Show the dependencies of a service
  10. Prevent the service to start without disabling it
  11. For the service created on 3, find its PID
  12. Find how much CPU load and memory is consuming
  13. Find out which open files the process has
  14. Find out which ports the service is listening on
  15. Reduce the priority of this process
  16. Terminate the process with a SIGKILL signal
  17. Locate the logs of the system where failed login attempts are registered
  18. Locate the logs where sudoers actiosn are registered
  19. Create a periodic task that executes every weekday at 5AM
  20. Create a periodic task that executes every monday that it is the first day of the month at 0AM
  21. What’s the difference between cron and anacron?
  22. Make an anacron file that starts a task 10 minutes after the system has started
  23. Create a BASH script that for a given input, it changes all the s to v. The change is case sensitive
  24. Verify the integrity of the RPM database
  25. Verify the integrity of a specific package
  26. List all kernel modules
  27. Load a specific module from the previous list
  28. Find its location on the filesystem
  29. Change the maximum number of open files allowed
  30. Make this change permanent without rebooting the system
  31. List all available packages that start with postgres
  32. List all available packages related to polkit
  33. Display all the information for one of them
  34. Install a random package
  35. Remove that package along all its dependencies
  36. Download the RPM package of a random package
  37. Use rpm and dnf to tell which package a file belongs to
  38. Show what files are included in a random package
  39. Show only the config files
  40. List all the dependencies of a package with RPM
  41. Show all the libraries used by a command
  42. Rebuild the library cache
  43. Browse the logs of all actions contrary to the SELinux policy
  44. Identify the current SELinux state
  45. Name the difference between the possible states
  46. Show the SELinux context of a file
  47. Show the SELinux context of a process
  48. Copy the SELinux context from one file to another
  49. Restore the previous context of the copied file
  50. What’s the difference between SELinux Booleans and contexts?
  51. List all posible booleans
  52. Get the explanation of one of them
  53. Change permanently the value of one of them
  54. What are SELinux ports?
  55. Show the type of port 22
  56. Add a port to a specific type
  57. Remove it
  58. Identify a process being blocked by SELinux
  59. Create a policy to avoid the errors discovered above
  60. Install the new policy

TODO

  • Make list prettier
  • Make each item of the list a link to a different post
  • Link to conceptual articles