Archiving
Archive and compress files to tar and xz
1
|
tar -I pxz -cf NAME-OF-COMPRESSED-FILE.tar.xz SOURCEDIRECTORY/
|
When using pigz for parallel gz compresion
1
|
tar -c --use-compress-program=pigz -f NAME.tar.gz directory/
|
Create tar.xz with more options
The -9
signifies compression level from 1 - 9, with 9 being highest compression. It is preferable to use 4-5 for best peformance to compression tradeoff. The -T
is CPU cores. 0 uses all cores.
1
|
tar -c -I 'xz -9 -T0' -f archivename.tar.xz filesAndor directories/
|
General Disk Management
These can be useful when managing a remote server
View disk info on system
1
|
sudo lsblk -o NAME,SIZE,FSTYPE,LABEL,UUID,MOUNTPOINT
|
Manage disk with fdisk
Where {} is the identifier for the disk of interest
Get disk UUID and info
Where x is the disk identifier and n is the partition number
1
|
sudo mkfs.ext4 /dev/sdxn
|
Change partition label
1
|
sudo e2label /dev/sdxn NAME
|
Fun with directories
Replace all directory names with spaces with underscores
1
|
for f in *\ *; do mv "$f" "${f// /_}"; done
|