Created
January 8, 2012 07:21
-
-
Save yangg/1577569 to your computer and use it in GitHub Desktop.
tar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zip | |
zip -r test.zip .vim .vimrc | |
unzip -l test.zip | |
zip -d test.zip filename_to_delete | |
zip -e test.zip path_to_file | |
zip -er test.zip path_to_folder | |
# rar | |
rar a test.rar .emacs.d .emacs | |
unrar x test.rar | |
# tar | |
# split tar to several files | |
tar cvjf - evernote-latest.exe | split -b 2m - evernote.tbz. | |
cat evernote.tbz.* | tar xvj | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
untar() { | |
if [ -f "$1" ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf "$1" ;; | |
*.tar.gz) tar xzf "$1" ;; | |
*.tar.xz) tar xJf "$1" ;; | |
*.bz2) bunzip2 "$1" ;; | |
*.rar) rar x "$1" ;; | |
*.gz) gunzip "$1" ;; | |
*.tar) tar xf "$1" ;; | |
*.tbz2) tar xjf "$1" ;; | |
*.tgz) tar xzf "$1" ;; | |
*.zip) unzip "$1" ;; | |
*.7z) 7zr x "$1" ;; | |
*.Z) uncompress "$1" ;; | |
*.dmg) hdiutil mount "$1" ;; | |
*) echo "\`$1' cannot be extracted via untar" ;; | |
esac | |
else | |
echo "\`$1' is not a valid file" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment