Re:Ask HN: Best things in your bash_profile/aliases?
by joshstrange on Monday January 14, 2019 @02:36PM
(#18905723)
This is awesome, I ALWAYS have to google for how to untar an archive (I don't do it often enough to commit to memory) thank you!
[ Parent
| on HN ]
Re:Ask HN: Best things in your bash_profile/aliases?
by aug-riedinger on Thursday January 24, 2019 @05:37AM
(#18987485)
I have:
function extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $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 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
instead
Re:Ask HN: Best things in your bash_profile/aliases?
by borplk on Tuesday January 15, 2019 @04:06AM
(#18909789)
tar czvf
"create ze vucking file"
tar xzvf
"extract ze vucking files"
Re:Ask HN: Best things in your bash_profile/aliases?
by stevekemp on Tuesday January 15, 2019 @02:35PM
(#18914160)
I have an alias "x" setup to run:
atool --extract $*
That will unpack "anything", into a sub-directory if necessary. Something I use more than any other alias.
Re:Ask HN: Best things in your bash_profile/aliases?
by zzo38computer on Monday January 14, 2019 @02:53PM
(#18905884)
There are man pages though, but still I suppose that might be useful to you.
Anyways, the only options for tar that I commonly use are "c", "x", and "t"; I will use other programs for decompression, and for extracting into a directory, will use cd.
Re:Ask HN: Best things in your bash_profile/aliases?
by acqq on Monday January 14, 2019 @03:15PM
(#18906062)
If the man pages had useful examples the “cheat sheets” would not be needed. So “duh use man pages” is a wrong and annoying answer in this context.
Re:Ask HN: Best things in your bash_profile/aliases?
by zzo38computer on Monday January 14, 2019 @07:03PM
(#18907784)
Yes, I suppose you are right, the man pages do not have sufficient examples. So, it is good that they add more there. (The man page still explains what all of the options are; now we have this "cheat sheets" with the examples, too.)