Bundle directories, inspect archives and restore files with the classic Linux archiver. 12.05.2026 | reading time: 2 min When files must be bundled, moved or backed up, use tar: the classic Linux tool to archive directories into a single file and optionally compress them; it creates "tarballs" that are easy to store, transfer and extract. Real-world backup example Do this to create, inspect and restore a compressed backup: create an archive with ```tar -czf website-backup.tar.gz /var/www/site```; list its contents with ```tar -tvf website-backup.tar.gz``` which might show ```-rw-r--r-- root/root 1234 2026-05-01 site/index.html```; then restore into a temporary folder with ```mkdir -p /tmp/restore && tar -xzf website-backup.tar.gz -C /tmp/restore```. Compression choices and key flags Choose options based on needs: use `-c` to create, `-x` to extract and `-t` to list; add `-v` for verbose and `-f` to name the file; select compression with `-z` for gzip, `-j` for bzip2 or `-J` for xz; preserve attributes with `-p`, skip files with `--exclude=pattern`, strip leading components with `--strip-components=N` and run incremental backups with `--listed-incremental` when you need fast, space-efficient snapshots. Transfer and append techniques Stream archives over SSH and avoid intermediate files by piping: ```tar -czf - /path/to/data | ssh backup.example.com 'cat > /backups/data-2026.tar.gz'```; append files to an existing archive with ```tar -rf archive.tar newfile``` although appending compressed archives is not supported, so work on uncompressed archives before compressing. When tar meets other tools Combine tar with compression and transfer utilities or choose alternatives for specific tasks: use compression programs for better ratios, rsync for differential transfers, or restic/borg for deduplicated backups when retention, encryption and efficient storage matter. Final steps Practice by creating archives, restoring subsets and testing restores on a throwaway directory; mastering tar means fewer surprises during recovery and smoother file transfers, so keep experimenting and consider formalizing skills with certifications and focused courses like the intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. backup utilities filesystem storage