This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!
Archives commands¶
TODO: split this cheat sheet in dedicated ones (one per command)
Table of contents¶
zip
¶
unzip
¶
tar
¶
-
Extract
.tar.gz
: -
Extract
.tar.bz2
: -
Compress to
.tar.gz
auto extraction¶
- Script automating extraction:
$ vi $HOME/.bashrc # or ${ZDOTDIR:-${HOME}}/.zshrc or wherever > ... > # archive extraction (usage: `$ ex <file-archive-to-extract>`) > # > # prerequisites: > # * tar: <https://repology.org/project/tar/versions> > # * unrar: <https://repology.org/project/unrar/versions> > # * unzip: <https://repology.org/project/unzip/versions> > ex () > { > if [ -f $1 ] ; then > case $1 in > *.tar.bz2) tar xjf $1 ;; > *.tar.gz) tar xzf $1 ;; > #*.bz2) bunzip2 $1 ;; > *.rar) unrar x $1 ;; > #*.gz) gunzip $1 ;; > *.tar) tar xf $1 ;; > *.tbz2) tar xjf $1 ;; > *.tgz) tar xzf $1 ;; > *.zip) unzip $1 ;; > #*.Z) uncompress $1;; > #*.7z) 7z x $1 ;; > #*.deb) ar x $1 ;; > *.tar.xz) tar xf $1 ;; > #*.tar.zst) unzstd $1 ;; > *) echo "'$1' cannot be extracted via ex()" ;; > esac > else > echo "'$1' is not a valid file" > fi > } > ... $ source $HOME/.bashrc # or ${ZDOTDIR:-${HOME}}/.zshrc or wherever
If this cheat sheet has been useful to you, then please consider leaving a star here.