CELE study materials
CELE study resources

CELE: Filesystem navigation and file management

CELE · Work through your exam, one topic at a time.

All guide sections

Filesystem navigation and file management

This domain, Filesystem navigation and file management, checks shell fluency as a file tool: moving through the hierarchy, locating files by attribute, copying and archiving safely, linking, and reading or filtering text streams.

Core commands

  • Navigation: pwd, cd, ls -la, absolute versus relative paths, . and ...
  • Finding: find walks the tree and filters on name, type, size, time, owner, and permissions; locate queries a database refreshed by updatedb and is fast but can be stale.
  • Text processing: cat, less, head, tail -f, grep, cut, sort, uniq, wc, sed, awk.
  • Copying and archiving: cp -a preserves mode, ownership, timestamps, and symlinks; rsync -a copies incrementally; tar -czf and tar -xzf create and extract archives.
  • Links: a hard link is another name for the same inode and cannot cross filesystems; a symlink is its own inode holding a path and can cross filesystems or point to a directory.

Worked example

Compress logs older than seven days with find /var/log -type f -name '*.log' -mtime +7 -exec gzip {} \;. Reasoning: -type f excludes directories and devices, -name limits the pattern, -mtime +7 means modified more than seven 24-hour periods ago, and -exec ... \; runs one command per match (-exec ... + batches arguments for speed). Test first by replacing the action with -print.

Traps

  • Running rm -rf with an unset or mistyped variable; quote and use ${var:?}.
  • Assuming cp -r preserves ownership and timestamps; it does not.
  • Deleting a symlink with a trailing slash, which can affect the target.
  • Feeding find output into a loop without -print0 and xargs -0, so spaces break it.