Canonical path review
Turn relative and linked paths into stable absolute locations.
Understand the pattern
Resolving canonical filesystem paths helps operators explain what they know before they change anything.
realpath- Resolve a path to its canonical location in the virtual filesystem.
Resolving a path and reading its contents are separate operations.
pwd- Print the directory that relative paths currently resolve from.
A relative path is interpreted from the working directory, not necessarily the home folder.
Worked example and expected result
$ realpath README.txt/home/learner/README.txt
Exit status: 0. The command completed successfully in the training fixture.
$ realpath /etc/nginx/sites-enabled/learn.conf/etc/nginx/sites-enabled/learn.conf
Exit status: 0. The command completed successfully in the training fixture.
$ pwd/home/learner
Exit status: 0. The command completed successfully in the training fixture.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: Temporary workspacesTry an incident drillAnonymous 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
- 01File type inspectionIdentify files, directories, links, and text before acting on them.Practice
- 02Temporary workspacesCreate bounded temporary files and directories for disposable work.Practice
- 03Sorted inventory comparisonCompare two sorted account inventories without modifying either file.Practice