| |

LFCS 161 ๐Ÿง LFCS Exam Objectives Review โ€” Domain 1

โฑ๏ธ Estimated read: 10 min | |

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

CommandPurpose
mkdir -pCreate the parent tree
cp -rCopy the directories
mvMove or rename
rm -rfRemove the directories
fileIdentify the type
statShow the inode and the metadata

Text Processing

CommandPurpose
grep -EExtended regex
sed -iIn-place edit
awk '{print $1}'Print the field
sortSort the lines
uniq -cCount the duplicates
teeWrite to file and screen

Archives and Links

CommandPurpose
tar -czvfCreate the gzip archive
tar -xzvfExtract the gzip archive
tar -tzvfList the archive
lnHard link
ln -sSoft link

Permissions

CommandPurpose
chmod 755Octal mode
chmod u+xSymbolic mode
chown user:groupChange the ownership
umask 027Default 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

PitfallWhy It HappensFix
Copy fails on the directoryNo -rAdd -r
Edit not savedNo -iAdd -i
Archive has the absolute pathsNo -CUse -C
Hard link on the directoryNot permittedUse the soft link
Permission deniedWrong mode or ownerchmod 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

ItemValue
Domain weighting20%
File managementmkdir, cp, mv, rm, ls
Text processinggrep, sed, awk
Streams>, >>, <, |, 2>&1
Archivestar, gzip
Linksln, ln -s
Permissionschmod, chown, umask
Exam formatLive 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 -r on the cp, the -i on the sed, the -C on the tar, the -E on the grep. 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 -s is the soft link. The ln without the -s is 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 755 is the octal. The chmod u+x is the symbolic. The umask sets 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.

Was this helpful?


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!