Intermediate · 12 min · practise every command in the built-in terminal

🎯 Mission Briefing: Restore From Backup

A teammate ran rm -rf in the wrong directory and the company website's source — ~/projects/website — is gone. Luckily a backup runs every night and lands in /backups. Bring the website back without overwriting anything else in your home directory.

Your objective

Find the most recent backup, look inside it before extracting, and restore only the website directory.

Toolkit

ls -lh /backups                                       # Which backups exist, and how fresh are they?
tar -tzf /backups/FILE.tar.gz                         # List what's inside (nothing is extracted)
tar -tzf /backups/FILE.tar.gz | grep website          # Narrow it down
tar -xzf /backups/FILE.tar.gz -C ~ projects/website   # Extract just one directory into your home
ls -la ~/projects/website                             # Check what came back

💡 Always list an archive before extracting it, and extract only what you need — so old copies don't overwrite newer files.

Practice tasks

  1. List the available backups
  2. List the contents of the newest backup without extracting it
  3. Restore only the website directory from the newest backup
  4. Check that the website files are back
  5. Confirm the restored page is last night's version

Missions