LFCS — Linux Foundation System Administrator exam Study Guide with Exercises
I recently took LFCS exam and was able to get my certificate in my first attempt. I know that it is a real struggle to have an achievement in this exam, especially in the first attempt, so I wanted to share my experience and prepare a study guide with a few exercises that you would most probably stumble upon very similar challenges in LFCS exam.
This post is intended to give you the understanding of what kind of tasks you might expect to get in the exam. As the time being, you can expect 24 tasks with multiple sub-tasks to solve in 2 hours time span. Key point to success will be the time management for most of you, and we know that practice makes perfect.
Distribution of tasks in exam are given from Linux Foundation as follows:
- Essential Commands — 25%
- Operation of Running Systems — 20%
- User and Group Management — 10%
- Networking — 12%
- Service Configuration — 20%
- Storage Management — 13%
You may even find a task with a few sub-tasks, coming from different subjects.
Don’t forget! using
man -k <command>can be very useful to list all the related commands with a short description. Use it wisely..
There is an exercise questions sheet provided originally by Linux foundation that I am adding the link below:
I encourage you to solve each task first in your practice environment. I will give the most practical solutions to a few of those tasks for each subject. Not only that, but I will also give some tips with a mention ‘good to know’ to give some alternative solutions for similar tasks. Let’s begin.
Domain — Essential Commands
Q1 — Open the file under home/student/textreferences/editme.txt and complete the following tasks:
1. Move line 777 to line 12. Remove line 7000. 3. Replace every occurrence of the word "Earth" shown with an uppercase E, with the word "Globe"4. Add a new line at the very end of the document that contains "Auctores Varii"
Since I don’t have a practice edit.txt file for this case, I will create one first:
The best practice is to use
sedfor any move and replace operation in Linux:
Q2 — Working with archives and compressed files is an integral part of the System Administrator’s job. Perform the following tasks to demonstrate your ability to work with archives and compressed files:
1. Extract all files from archive file /opt/SAMPLE001.zip into target directory /opt/SAMPLE0012. Create a tar archive file /opt/SAMPLE0001.tar containing all files in the directory /opt/SAMPLE001 3. Compress the tar archive file /opt/SAMPLE0001.tar using the bzip2 compression algorithm 4. Compress the tar archive file /opt/SAMPLE0001.tar using the xz compression algorithm Make sure that the uncompressed archive file /opt/SAMPLE0001.tar is not removed after creating the compressed versions of the archive file!
Domain — Operation of Running Systems
Q1 — Create a bash shell script named certscript.sh under /home/student/apps/
1. Make sure the script can be invoked as ./certscript.sh2. The first line of output from the script should consist of the name of the user who invoked it.3. The second line of output should contain the IP address of the default gateway.
We will test it out first with a few examples and after that create our script and update the permissions to make it executable
Let’s create certscript.sh with these findings in mind:
Make it executable by changing permissions and run it for testing:
Q2 — Create a cron job that kills all processes named
scan_filesystemwhich is owned by root, every minute.
To check your cron job logs, enter:
tail -f /var/log/syslog
man crontabgives you a detailed information on how to use the command but it doesn’t provide any useful examples. using
man 5 crontabdocumentation manual can definitely save you day with a lot of useful examples and use cases.
Domain — User & Group Management
Q1 — Create a candidate user account with the password cert456. Modify the sudo configuration to let the candidate account access root privileges with no password prompt.
Q2 — Configure the system so that an empty NEWS file is automatically created in the home directory of any new user.
Q3 — Create a new user account with the following attributes:
- Username is harry.
- Password is magic.
- This user’s home directory is defined as /home/school/harry/
- This new user is a member of the existing students group
- The /home/school/harry/binaries/ directory is part of the PATH variable.
Domain — Networking
Q1 — Find ports under /etc/services
1. Find the name of the service which uses TCP port 2605, as documented in /etc/services, and write the service name to the file /home/student/port-2605.txt.2. Find all the ports used for TCP services IMAP3 and IMAPS, again as documented in /etc/services, and write those port numbers to the file /home/student/imap-ports.txt
Service Configuration and Storage Management domains are also very important as you may expect around 30–35% of the tasks from these two, but this post is already long enough to cover all the tasks with detailed solutions of the practice questions. I will cover the other questions in the pdf in part-2 of this study guide. Please feel free to ask me any questions and follow me for getting part-2 of this post when it is released.