Lab 05: Copying and Moving Files
Objective
Step 1: Setup — Create Files to Work With
mkdir -p /tmp/lab5
cp /etc/passwd /tmp/lab5/
ls -la /tmp/lab5/total 12
drwxr-xr-x 2 root root 4096 Mar 5 00:55 .
drwxrwxrwt 1 root root 4096 Mar 5 00:55 ..
-rw-r--r-- 1 root root 922 Mar 5 00:55 passwdStep 2: Copying Files
# Copy to new name (same directory)
cp /tmp/lab5/passwd /tmp/lab5/passwd.bak
ls -la /tmp/lab5/Step 3: Copying Directories (Recursive)
Step 4: Moving and Renaming with mv
Step 5: Comparing Files with diff
Step 6: Preserving Metadata
Step 7: Safe Moves with Confirmation
Step 8: Capstone — Incident Response Backup Script
Summary
Command
Purpose
Last updated
