Skip to content

Compression & Archiving

When working with simulations and large datasets, it’s often useful to compress or archive files to save space and make sharing easier. Linux, WSL, and macOS provide built-in commands for creating and extracting compressed archives.

Creating Archives

CommandDescriptionExample
tar -cvf archive.tar folder/Create an uncompressed archivetar -cvf results.tar results/
tar -czvf archive.tar.gz folder/Create a compressed .tar.gz archivetar -czvf mesh_data.tar.gz mesh/
zip -r archive.zip folder/Create a .zip filezip -r project_backup.zip project/

Extracting Archives

CommandDescriptionExample
tar -xvf archive.tarExtract a .tar archivetar -xvf results.tar
tar -xzvf archive.tar.gzExtract a compressed .tar.gz filetar -xzvf mesh_data.tar.gz
unzip archive.zipExtract a .zip fileunzip project_backup.zip

Summary

  • Use tar for Linux-style archives (.tar / .tar.gz).
  • Use zip and unzip for cross-platform compatibility.
  • Compressing simulation results or mesh files helps save space and makes backups or sharing much faster.