Skip to content
Snippets Groups Projects
Commit fcd0b3bb authored by GitLab CI's avatar GitLab CI
Browse files

Update Content

parent 8b3141b8
Branches
No related tags found
No related merge requests found
Pipeline #309 skipped
---
title: Make XZ archives using ALL your cores
date: 2025-03-31T11:06:13+01:00
draft: false
tags:
- ubuntu
- debian
- sysadmin
---
If you've ever used tar, you'll realise it's really slow when it comes to compressing. That's because the compression is pinned to one core by default - or, at least that's what I've found.
For the following commands, you'll need GNU tar. If you're on Linux, you'll have it already, but if you're on BSD, you'll need to install GNU tar and use it with `gtar` instead of `tar`.
In the GNU version of tar, there is a switch, `-I`, which allows you to specify the compression command. Using `xz -T0` as this command you can use all of the cores in your system to compress files.
For example, to compress the folder `driving2` into a file called `driving2.tar.xz` using all possible cores for compression, you would run this command:
```
tar -c -I 'xz -T0' -f ./driving2.tar.xz ./driving2
```
And as you can see, all the cores are being used:
![Pasted image 20250331111347.png](/images/Pasted%20image%2020250331111347.png)
\ No newline at end of file
static/images/Pasted image 20250331111347.png

321 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment