Using CheatSheets To Apply Best Practices

CheatSheet: Linux Compress And Decompress

CheatSheet: Linux Compress And Decompress

<a href=”https://github.com/dennyzhang/cheatsheet.dennyzhang.com/tree/master/cheatsheet-archive-A4“><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=”https://www.linkedin.com/in/dennyzhang001“><img src=”linkedin.png” alt=”linkedin” /></a></div>
<div style=”float: left; padding: 5px”><a href=”https://github.com/dennyzhang“><img src=”github.png” alt=”github” /></a></div>
<div style=”float: left; padding: 5px”><a href=”https://www.dennyzhang.com/slack” target=”blank” rel=”nofollow”><img src=”slack.png” alt=”slack”/></a></div>
</div>

<br/><br/>
<a href=”http://makeapullrequest.com” 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 ./file.zip
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 ./file.zip <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 my.zip some_folder

1.4 More Resources

http://www.simplehelp.net/2008/12/15/how-to-create-and-extract-zip-tar-targz-and-tarbz2-files-in-linux

License: Code is licensed under MIT License.

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

<a href=”https://www.linkedin.com/in/dennyzhang001“><img align=”bottom” src=”linkedin.png” alt=”linkedin” /></a>
<a href=”https://github.com/dennyzhang“><img align=”bottom”src=”github.png” alt=”github” /></a>
<a href=”https://www.dennyzhang.com/slack” 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 *