Appearance
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
| Command | Description | Example |
|---|---|---|
tar -cvf archive.tar folder/ | Create an uncompressed archive | tar -cvf results.tar results/ |
tar -czvf archive.tar.gz folder/ | Create a compressed .tar.gz archive | tar -czvf mesh_data.tar.gz mesh/ |
zip -r archive.zip folder/ | Create a .zip file | zip -r project_backup.zip project/ |
Extracting Archives
| Command | Description | Example |
|---|---|---|
tar -xvf archive.tar | Extract a .tar archive | tar -xvf results.tar |
tar -xzvf archive.tar.gz | Extract a compressed .tar.gz file | tar -xzvf mesh_data.tar.gz |
unzip archive.zip | Extract a .zip file | unzip project_backup.zip |
Summary
- Use
tarfor Linux-style archives (.tar/.tar.gz). - Use
zipandunzipfor cross-platform compatibility. - Compressing simulation results or mesh files helps save space and makes backups or sharing much faster.