Skip to content
Clairos Learn

Files and paths · Lesson 32 of 36 · 8 minutes

Sorted inventory comparison

Compare two sorted account inventories without modifying either file.

Mastery 0/3Run itExplain itApply it
learner@clairosSimulated Linux lab
learner@clairos:~ $
↑ history · Tab complete · Ctrl+C cancel · Esc, Tab to leaveExit 0

Understand the pattern

Comparing sorted inventories with comm helps operators explain what they know before they change anything.

cat
Read one or more files to standard output without editing their contents.

Reading a source file should precede changing it; avoid printing real secrets.

comm
Compare sorted line sets and select unique or common columns.

Both inputs must be sorted under the same ordering rules.

Worked example and expected result
$ cat data/users-a.txt
admin
learner
www-data

Exit status: 0. The command completed successfully in the training fixture.

$ cat data/users-b.txt
backup
learner
www-data

Exit status: 0. The command completed successfully in the training fixture.

$ comm data/users-a.txt data/users-b.txt
admin
	backup
		learner
		www-data

Exit status: 0. The command completed successfully in the training fixture.

Try a variation

Repeat this workflow in the sandbox with a different scratch filename. Keep the system fixtures unchanged and compare the observed output with your expectation before moving on.

Explain it

In “Sorted inventory comparison”, which interpretation is safe?

Apply it elsewhere

Before adapting the cat workflow from “Sorted inventory comparison” to another server, what should you do?

Keep the momentum.

Complete the lab, then explain and apply the pattern.

Next: Restore copy verificationTry an incident drill

Anonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.

Keep learning

  1. 01Temporary workspacesCreate bounded temporary files and directories for disposable work.Practice
  2. 02Restore copy verificationCopy a restore candidate and compare it with its source.Practice
  3. 03Symlink chain auditCreate a link, inspect its stored target, and resolve the final path.Practice