- archive operation lines up files end-to-end - compression operation reduces size of a file # `cpio` - "copy in, copy out" - takes list of files on `stdin` and dumps them into `stdout` - `ls | cpio -o > archive.cpio` adds all files in current directory into an archive - `find folder | cpio -o > archive.cpio` adds everything within folder into an archive - `cpio -i < archive.cpio` unpacks archive into current directory # `dd` - "disk dump" or "data duplicate" - usually used for wiping or imaging devices - `sudo dd if=/dev/zero of=/dev/sda` to write zeros to a drive - `status=progress` to show verbose live info - `bs=10K` to specify block size (default 512B) - `sudo dd if=/dev/sda1 of=~/sda1.img` to create an image of a partition # `tar` - archives files; stands for "tape archive" - `tar -cf file_archive target` creates archive of target - `tar -xf file_archive` extracts archive - `tar -tf file_archive` shows contents of archive # All-in-one `tar` commands - `tar -cvzf archive.tgz target` archives target with tar and compresses with gzip including verbose output - able to archive multiple files at once with globbing - `tar -xvjf archive.tbz` decompresses target with bzip2 and extracts with tar including verbose output - `tar -xvJf archive.txz` decompresses target with xz and extracts with tar including verbose output # `gzip` - `gzip target` compresses target into tar.gz or tgz file - `gzip -k target` compresses target while keeping original target - `gzip -d target` decompresses target - `gunzip target` decompresses target # `bzip2` - newer, greater compression than gzip - `bzip2 target` compresses target into tar.bz2 or tbz file - `bzip2 -k target` compresses target while keeping original target - `bzip2 -d target` decompresses target - `bunzip2 target` decompresses target # `xz` - newer, greater compression than bzip2 - `xz target` compresses target into tar.xz or txz file - `xz -k target` compresses target while keeping original target - `xz -d target` decompresses target - `unxz target` decompresses target # `zip` - archives and compresses in one process - `zip -r archive.zip target` recursively archives and compresses target with zip - `unzip archive.zip` decompresses and extracts target with zip