🔧 Tools & Platforms
Linux File Management
Linux treats everything as a file — regular files, directories, devices, sockets, and pipes all live in a single hierarchical filesystem rooted at `/`. Bresnahan and Blum cover the essential operations for managing this filesystem: creating, copying, moving, and deleting files and directories; searching for files by name, type, size, or content; extracting and transforming text data; and archiving files for backup or distribution. Mastering these operations means you can navigate any Linux system, find any file, and manipulate any data — whether you're managing a single server or a fleet of containers.
2
Minutes
2
Concepts
+45
XP
1
How It Works
  1. The Filesystem Hierarchy Standard (FHS) — Linux organizes files by purpose, not by application:
  • /bin, /usr/bin — essential user commands
  • /etc — system configuration files
  • /home — user home directories
  • /var — variable data (logs, databases, mail)
  • /tmp — temporary files (cleared on reboot)
  • /opt — optional/third-party software
  • /proc, /sys — virtual filesystems exposing kernel and hardware info
  1. Core file operationscp (copy), mv (move/rename), rm (remove), mkdir (create directory), rmdir (remove empty directory), touch (create empty file / update timestamp), ln (create links). Key flags: cp -r (recursive), rm -rf (force recursive delete — use with extreme caution), mkdir -p (create parent directories).
  1. Finding files with find and locatefind searches the live filesystem with powerful criteria:
  • By name: find /var -name "*.log"
  • By type: find / -type d -name config
  • By size: find /home -size +100M
  • By time: find /tmp -mtime +7 (modified more than 7 days ago)
  • With actions: find . -name "*.tmp" -exec rm {} \;

locate searches a pre-built database (faster but potentially stale; update with updatedb).

  1. Searching content with grepgrep searches file contents for patterns:
  • Basic: grep "ERROR" /var/log/syslog
  • Recursive: grep -r "TODO" /home/dev/project/
  • With context: grep -C 3 "exception" app.log
  • Regex: grep -E "^[0-9]{4}-[0-9]{2}" access.log
  • Inverted: grep -v "DEBUG" app.log (exclude matches)
  1. Archiving and compressiontar bundles files; compression tools reduce size:
  • Create archive: tar -cvf backup.tar /etc/
  • Create compressed: tar -czvf backup.tar.gz /etc/ (gzip) or tar -cjvf backup.tar.bz2 /etc/ (bzip2)
  • Extract: tar -xzvf backup.tar.gz -C /restore/
  • List contents: tar -tzvf backup.tar.gz