Using CheatSheets To Apply Best Practices

CheatSheet: Linux Compress And Decompress

CheatSheet: Linux Compress And Decompress

<a href=”“><img align=”right” width=”200″ height=”183″ src=”github.png” /></a>
<div id=”the whole thing” style=”overflow: hidden;”>
<div style=”float: left; padding: 5px”> <a href=”“><img src=”linkedin.png” alt=”linkedin” /></a></div>
<div style=”float: left; padding: 5px”><a href=”“><img src=”github.png” alt=”github” /></a></div>
<div style=”float: left; padding: 5px”><a href=”” target=”blank” rel=”nofollow”><img src=”slack.png” alt=”slack”/></a></div>

<a href=”” target=”blank” rel=”nofollow”><img src=”PRs-welcome-brightgreen.svg” alt=”PRs Welcome”/></a>

File me Issues or star this repo.

1.1 Decompress

Name Summary
Unpack *.tar tar -xvf ./file.tar
Unpack *.tar.gz tar xvzf ./file.tar.gz
Unpack *.rar unrar e ./file.rar
Unpack *.zip unzip ./
Unpack *.gz gunzip ./file.gz; gzip -d file.gz
Unpack *.bz2 tar -jxvf file.tar.bz2 -C /tmp/extract_here/
Unpack *.7z 7z e ./file.7z install p7zip first
Unpack *.xz tar -xf ./file.tar.xz
Unpack *.jar jar -xvf ./file.jar
Unpack *.war jar -xvf ./file.war
Unpack *.tgz tar -xf ./file.tgz

1.2 Compress Common Format

Name Command
Pack to *.tar tar -cvf ./file.tar <dir_to_compress>
Pack to *.gz tar -zcvf ./newfile.tar.gz <dir_to_compress>
Pack to *.tgz tar -cvzf backup.tgz *
Pack to *.bz2 tar -cvf ./file.tar.bz2 <dir_to_compress>
Pack to *.zip zip -r ./ <dir_to_compress>

1.3 Advanced Usage

Name Command
Pack with exclude tar --exclude "*.git*" -cvf file.tar <dir_to_compress>
Remove a single file from tarball tar --delete -f file.tar file1.txt
Add file to tarball. -r indicates append tar -rf file.tar file1.txt
Create archive with password protection zip -er some_folder

1.4 More Resources

License: Code is licensed under MIT License.

<a href=”“><img align=”right” width=”201″ height=”268″ src=”denny_201706.png“></a>
<a href=”“><img align=”right” src=”cheatsheet_dns.png“></a>

<a href=”“><img align=”bottom” src=”linkedin.png” alt=”linkedin” /></a>
<a href=”“><img align=”bottom”src=”github.png” alt=”github” /></a>
<a href=”” target=”blank” rel=”nofollow”><img align=”bottom” src=”slack.png” alt=”slack”/></a>

Emacs 25.1.1 (Org mode 8.2.10)

Leave a Reply

Your email address will not be published. Required fields are marked *