LFCS 161 ๐ง LFCS Exam Objectives Review โ Domain 1
The previous chapters covered the technical content of the LFCS exam: the shell, the storage, the networking, the security, and the virtualization. This chapter begins the review of the exam objectives, starting with Domain 1: Essential Commands. The LFCS is a performance-based exam, which means the review must be the practice, not the memorization. The domain weighting is 20% of the total score, and the objectives cover the file management, the text processing, the streams and pipes, the archiving, and the file permissions. The critical trap is the assumption that the “Essential Commands” are the basic commands that the candidate already knows. The exam tests the flags, the combinations, and the edge cases that the daily use does not exercise.
Key point: The Essential Commands domain is 20% of the exam. The objectives are the file and directory management, the text processing with grep/sed/awk, the I/O redirection and pipes, the archiving and compression, the hard and soft links, and the file permissions. The review is the practice on the live terminal, not the reading of the notes.
Why the objectives review requires a specific mental model
The practice problem. The LFCS is not a multiple-choice exam. The candidate performs the tasks in a live terminal, and the grader checks the state of the system. The reading of the commands is not the same as the execution. The grep with the -E flag, the sed with the -i flag, the find with the -exec flag, and the tar with the -C flag are the examples of the commands that the candidate must type without the reference.
The coverage problem. The domain is broad. The objectives cover the file operations, the text processing, the archives, the links, the permissions, and the basic scripting. The candidate must demonstrate the proficiency across the entire domain, not the specialization in one area. The review must be systematic: the objective by the objective, the command by the command.
The trap problem. The exam tests the commands that the daily use does not exercise. The ln -s versus the ln (the soft link versus the hard link). The chmod with the octal versus the symbolic mode. The tar with the relative versus the absolute paths. The find with the -type and the -name and the -mtime. The review must include the edge cases, not just the common usage.
The time problem. The exam is two hours for the 20โ30 tasks. The candidate must complete the tasks quickly. The fluency with the commands is the requirement. The review must include the timed practice, not just the untimed reading.
The trade-off. The review is the practice. The reading is the supplement. The candidate who reads the notes without typing the commands will fail on the exam. The candidate who types the commands without the structured review will miss the objectives that the exam tests.
a. The file and directory management
The objectives: the create, the delete, the copy, the move, and the list. The commands: mkdir, rmdir, rm, cp, mv, ls, touch, file, stat.
# Create a directory tree
mkdir -p /tmp/lab/a/b/c
# Copy the directory recursively
cp -r /tmp/lab /tmp/lab-copy
# Move and rename
mv /tmp/lab-copy /tmp/lab-moved
# List with the details
ls -la /tmp/lab-moved
# Remove the directory tree
rm -rf /tmp/lab-moved
The -p flag creates the parent directories. The -r flag copies the directories recursively. The -a flag on the ls shows the hidden files and the details. The -rf flag on the rm removes the directories without the prompt.
The file command identifies the type of the file. The stat shows the inode, the size, the permissions, and the timestamps.
b. The text processing and the streams
The objectives: the search, the edit, the filter, and the redirect. The commands: grep, sed, awk, cut, sort, uniq, head, tail, tee, >, >>, <, |, 2>.
# Search with the extended regex
grep -E '^(error|warn)' /var/log/syslog
# In-place edit
sed -i 's/old/new/g' /tmp/config.txt
# Print the first field
awk '{print $1}' /etc/passwd
# Sort and deduplicate
sort /tmp/list.txt | uniq -c
# Redirect stdout and stderr
command > /tmp/out.log 2>&1
# Tee to file and screen
command | tee /tmp/copy.log
The grep -E enables the extended regex (the same as egrep). The sed -i edits the file in place. The awk '{print $1}' prints the first whitespace-separated field. The uniq -c counts the occurrences. The 2>&1 redirects stderr to stdout, which combines them. The tee writes to the file and to the terminal.
The head -n 5 and the tail -n 5 show the first and the last five lines. The tail -f follows the file.
c. The archives, the links, and the permissions
The objectives: the create and extract the archives, the create the hard and soft links, and the set the permissions. The commands: tar, gzip, ln, chmod, chown, chgrp, umask.
# Create a gzip archive
tar -czvf /tmp/backup.tar.gz -C /tmp lab/
# Extract to a directory
tar -xzvf /tmp/backup.tar.gz -C /tmp/restore/
# Create a hard link
ln /tmp/file.txt /tmp/file-hardlink
# Create a soft link
ln -s /tmp/file.txt /tmp/file-softlink
# Octal permissions
chmod 755 /tmp/script.sh
# Symbolic permissions
chmod u+x,g-w,o-r /tmp/script.sh
# Change the ownership
chown alice:devs /tmp/file.txt
# Set the default umask
umask 027
The tar -czvf creates the gzip archive. The -C changes the directory before the archive, which makes the paths relative. The ln creates the hard link (the same inode). The ln -s creates the soft link (the path reference). The chmod 755 sets the rwxr-xr-x. The chmod u+x,g-w,o-r sets the permissions symbolically. The chown alice:devs changes the owner and the group. The umask 027 sets the default permissions to 750 for the new files.
Complete Example Session
# ============================================
# PART 1: CREATE THE DIRECTORY TREE
# ============================================
mkdir -p /tmp/lab/a/b/c
ls -la /tmp/lab
# ============================================
# PART 2: CREATE THE FILE
# ============================================
echo "line 1" > /tmp/lab/file.txt
echo "line 2" >> /tmp/lab/file.txt
# ============================================
# PART 3: TEXT PROCESSING
# ============================================
grep -E "^line" /tmp/lab/file.txt
sed -i 's/line/LINE/g' /tmp/lab/file.txt
cat /tmp/lab/file.txt
# ============================================
# PART 4: STREAMS AND PIPES
# ============================================
cat /tmp/lab/file.txt | sort | uniq -c
# ============================================
# PART 5: ARCHIVES
# ============================================
tar -czvf /tmp/lab.tar.gz -C /tmp lab/
tar -tzvf /tmp/lab.tar.gz
# ============================================
# PART 6: EXTRACT
# ============================================
mkdir -p /tmp/restore
tar -xzvf /tmp/lab.tar.gz -C /tmp/restore
ls /tmp/restore/lab
# ============================================
# PART 7: LINKS
# ============================================
ln /tmp/lab/file.txt /tmp/lab/file-hard
ln -s /tmp/lab/file.txt /tmp/lab/file-soft
ls -li /tmp/lab/file.txt /tmp/lab/file-hard /tmp/lab/file-soft
# ============================================
# PART 8: PERMISSIONS
# ============================================
chmod 644 /tmp/lab/file.txt
chmod u+x /tmp/lab/file.txt
ls -l /tmp/lab/file.txt
# ============================================
# PART 9: CLEANUP
# ============================================
rm -rf /tmp/lab /tmp/restore /tmp/lab.tar.gz
The nine parts trace the Domain 1 objectives: the directory tree, the file creation, the text processing, the streams, the archives, the extraction, the links, the permissions, and the cleanup.
Quick Reference
File Management
| Command | Purpose |
|---|---|
mkdir -p | Create the parent tree |
cp -r | Copy the directories |
mv | Move or rename |
rm -rf | Remove the directories |
file | Identify the type |
stat | Show the inode and the metadata |
Text Processing
| Command | Purpose |
|---|---|
grep -E | Extended regex |
sed -i | In-place edit |
awk '{print $1}' | Print the field |
sort | Sort the lines |
uniq -c | Count the duplicates |
tee | Write to file and screen |
Archives and Links
| Command | Purpose |
|---|---|
tar -czvf | Create the gzip archive |
tar -xzvf | Extract the gzip archive |
tar -tzvf | List the archive |
ln | Hard link |
ln -s | Soft link |
Permissions
| Command | Purpose |
|---|---|
chmod 755 | Octal mode |
chmod u+x | Symbolic mode |
chown user:group | Change the ownership |
umask 027 | Default permissions |
Best Practices
โ Do This:
cp -r /tmp/lab /tmp/lab-copy
<!-- Use the -r for the directories --> # โ
sed -i 's/old/new/g' /tmp/config.txt
<!-- Use the -i for the in-place edit --> # โ
tar -czvf /tmp/backup.tar.gz -C /tmp lab/
<!-- Use the -C to avoid the absolute paths --> # โ
โ Don’t Do This:
cp /tmp/lab /tmp/lab-copy
<!-- Fails on the directories without -r --> # โ
sed 's/old/new/g' /tmp/config.txt
<!-- Prints to stdout, does not edit --> # โ
tar -czvf /tmp/backup.tar.gz /tmp/lab/
<!-- Absolute paths in the archive --> # โ
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| Copy fails on the directory | No -r | Add -r |
| Edit not saved | No -i | Add -i |
| Archive has the absolute paths | No -C | Use -C |
| Hard link on the directory | Not permitted | Use the soft link |
| Permission denied | Wrong mode or owner | chmod and chown |
Real-World Examples
1. Create Directory
mkdir -p /tmp/lab/a/b/c
2. Copy Recursive
cp -r /tmp/lab /tmp/lab-copy
3. Search Text
grep -E '^error' /var/log/syslog
4. Edit Text
sed -i 's/foo/bar/g' file.txt
5. Extract Field
awk -F: '{print $1}' /etc/passwd
6. Create Archive
tar -czvf /tmp/backup.tar.gz -C /tmp lab/
7. Hard Link
ln /tmp/file.txt /tmp/file-hard
8. Soft Link
ln -s /tmp/file.txt /tmp/file-soft
9. Set Permissions
chmod 644 /tmp/file.txt
10. Change Ownership
chown alice:devs /tmp/file.txt
Visual
Domain 1 Structure
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Domain 1: Essential Commands (20%) โ
โ โโโ File management โ
โ โโโ Text processing โ
โ โโโ Streams and pipes โ
โ โโโ Archives and compression โ
โ โโโ Links โ
โ โโโ Permissions โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Exam Task Flow
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Task: Create the directory tree โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Task: Copy the files with the permissions โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Task: Search the pattern in the logs โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Task: Create the archive and extract it โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Task: Set the ownership and the mode โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
| Item | Value |
|---|---|
| Domain weighting | 20% |
| File management | mkdir, cp, mv, rm, ls |
| Text processing | grep, sed, awk |
| Streams | >, >>, <, |, 2>&1 |
| Archives | tar, gzip |
| Links | ln, ln -s |
| Permissions | chmod, chown, umask |
| Exam format | Live tasks |
Key takeaways:
- The domain is 20% of the exam. The Essential Commands cover the file management, the text processing, the streams, the archives, the links, and the permissions. The candidate must be fluent in the commands, not just familiar.
- The practice is the review. The exam is the live tasks. The reading of the commands is not the same as the typing. The review must be the terminal practice, the timed, and the complete.
- The flags are the trap. The
-ron thecp, the-ion thesed, the-Con thetar, the-Eon thegrep. The flags change the behavior, and the exam tests the specific flag for the task. - The links are the common pitfall. The hard link and the soft link are not the same. The
ln -sis the soft link. Thelnwithout the-sis the hard link. The hard link cannot be the directory, and the soft link can. - The permissions are the octal and the symbolic. The
chmod 755is the octal. Thechmod u+xis the symbolic. Theumasksets the default. The exam tests both.
Remember: Domain 1 is the foundation. The exam tasks assume the fluency with the file operations, the text processing, and the permissions. The review is the practice, not the reading. The commands are the tools; the exam is the application.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!