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 Goal | Command |
---|---|
Boot, reboot, and shut down a system safely | shutdown |
Boot or change system into different operating modes | `systemctl isolate |
Install, configure and troubleshoot bootloader | `grub2-[install |
Manage the startup process and services | systemctl /etc/systemd/system/ UNIT-files format |
Diagnose and manage processes | ps /proc kill `p(grep |
Verify the integrity & availability of key processes | Same 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 time | crond /etc/cron.d anacron at |
Use scripting to automate system maintenance tasks | BASH + crond |
Verify completion of scheduled jobs | /var/log/cron |
Verify the integrity & availability of resources | rpm -V |
Change kernel runtime parameters, (non-)persistent | /etc/sysctl.conf /etc/sysctl.d sysctl |
Manage Software | `dnf [info |
Update software packages | dnf check-updates dnf update |
Identify the package that a file belongs to | rpm -qf |
Identify SELinux/AppArmor file and process contexts | -Z chcon restorecon semanage `audit2[allow |
Review questions
- Switch the current run-level to the multi-user level
- make the previous change persistant
- make this change persistant through the bootloader
- Install GRUB bootloader on a new partition
- Make a configuration change and re-install the bootloader
- Find out if a service is running
- Create a ls service that uses netcat to listen for connections on a choosen port
- Make this new service to start on boot
- Show the dependencies of a service
- Prevent the service to start without disabling it
- For the service created on 3, find its PID
- Find how much CPU load and memory is consuming
- Find out which open files the process has
- Find out which ports the service is listening on
- Reduce the priority of this process
- Terminate the process with a SIGKILL signal
- Locate the logs of the system where failed login attempts are registered
- Locate the logs where sudoers actiosn are registered
- Create a periodic task that executes every weekday at 5AM
- Create a periodic task that executes every monday that it is the first day of the month at 0AM
- What’s the difference between cron and anacron?
- Make an anacron file that starts a task 10 minutes after the system has started
- Create a BASH script that for a given input, it changes all the s to v. The change is case sensitive
- Verify the integrity of the RPM database
- Verify the integrity of a specific package
- List all kernel modules
- Load a specific module from the previous list
- Find its location on the filesystem
- Change the maximum number of open files allowed
- Make this change permanent without rebooting the system
- List all available packages that start with postgres
- List all available packages related to polkit
- Display all the information for one of them
- Install a random package
- Remove that package along all its dependencies
- Download the RPM package of a random package
- Use rpm and dnf to tell which package a file belongs to
- Show what files are included in a random package
- Show only the config files
- List all the dependencies of a package with RPM
- Show all the libraries used by a command
- Rebuild the library cache
- Browse the logs of all actions contrary to the SELinux policy
- Identify the current SELinux state
- Name the difference between the possible states
- Show the SELinux context of a file
- Show the SELinux context of a process
- Copy the SELinux context from one file to another
- Restore the previous context of the copied file
- What’s the difference between SELinux Booleans and contexts?
- List all posible booleans
- Get the explanation of one of them
- Change permanently the value of one of them
- What are SELinux ports?
- Show the type of port 22
- Add a port to a specific type
- Remove it
- Identify a process being blocked by SELinux
- Create a policy to avoid the errors discovered above
- Install the new policy
TODO
- Make list prettier
- Make each item of the list a link to a different post
- Link to conceptual articles