↑ ↓ select, Enter open, Esc close

Restore a single file from a tar backup

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
user@server
mkdir -p /tmp/restore && tar -xzf /var/backups/example.com-httpdocs-2026-10-09.tar.gz -C /tmp/restore ./wp-config.php

Extracts only the given entry into the target directory. The path must be specified exactly as it appears in the archive, so for archives created with -C PFAD . it needs the leading ./. Entire subfolders such as ./wp-content/themes can be extracted the same way.

Note: tar -tzf ARCHIV | grep NAME shows the exact path beforehand. A file with the same name in the target is overwritten, so use a separate restore directory.

Also searched as

  • extract single file from tar.gz
  • restore one file from backup
  • restore wp-config from backup
  • recover deleted file from archive

Related one-liners

All in rsync and backup

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.