You are not logged in.
Pages: 1
It doesn't matter whether things are .tar, .tar.bz, .tar.gz2, it seems like whenever I do tar -xvf it just does it for me. On the one hand this rocks, but on the other hand this contradicts everything on the internet and the man pages...So what does tar -xvf do?
Offline
Saves one second of your life everytime you unpack something?
It just auto detects the format.
Offline
really? I have to use -xf for tar, -xzf for tar.gz, and -xjf for tar.bz2 =P
Last edited by Stythys (2008-06-09 03:32:05)
[home page] -- [code / configs]
"Once you go Arch, you must remain there for life or else Allan will track you down and break you."
-- Bregol
Offline
cool, I didn't know this. I always did "tar xzf" or "tar xjf"... It might be in the "info pages"
Offline
Wow. I also have been -xzvf-ing and -xjvf-ing for years. You learn something new every day. Thanks
Offline
I have just put this in .bashrc
# extract archives -- usage: extract <file>
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
}
Offline
What the heck, when did this happen?
Offline
Yeah, I guess this is pretty cool. So is anything in xvf unnecessary? What does f do?
Offline
Yeah, I guess this is pretty cool. So is anything in xvf unnecessary? What does f do?
It tells 'tar' that you are extracting a 'f'ile.
Check out the tar man page for more.
Offline
You can just tar xf if you want, v is verbose. f just tells it you are giving it a file to extract.
Offline
Offline
I was surprised too when I found out it autodetects.
Offline
Should I be worried if tar doesn't have a man page (I would've looked there before wasting your time, Misfit)?
Offline
Should I be worried if tar doesn't have a man page
There is one... Check that you have merged /etc/profile.pacnew.
Offline
this is GNU tar and bsdtar only. Other tars won't necessarily do it.
Offline
I weep for all of those wasted j's and z's that have been typed in vain.
Offline
man...I didn't know that either. I feel like such an old-timer!
Offline
Saves one second of your life everytime you unpack something?
It just auto detects the format.
If it matches what's in it .
I don't know what the - is for (GNU tar doesn't really need it afaik, maybe for compatibility reasons), tar xf should be plenty most of the time.
Last edited by B (2008-06-12 00:42:11)
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
I have just put this in .bashrc
# extract archives -- usage: extract <file> 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 }
I keep getting the error below when the above is pasted in .bashrc.
bash: /home/xslash/.bashrc: line 110: syntax error near unexpected token `}'
bash: /home/xslash/.bashrc: line 110: `}'
The weird thing is I can't find anything different from the above. Would deeply appreciate if someone could enlighten me.
Thanks.
Offline
onguarde: why not try atool?
It is basically a fleshed out version but with more features and it protects against tar bombs.
Offline
hooray! seriously, I hated having to check my brain against the extension every time. Now I just have to retrain my fingers.
Offline
You can just tar xf if you want, v is verbose. f just tells it you are giving it a file to extract.
+1
I always use
tar xf $archive
The thing is, a lot of Linux/UNIX apps check the first bytes of a file (the header). That is what e.g. the 'file' utility does. Tar does probably the same, so it does not need you to determine what type of file it is . As is said often, extensions are for humans (and Windows
).
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Pages: 1