Jump to content

Extracting, tar.bz2 tar.gz and zip at command line


iphitus
 Share

Recommended Posts

  • 1 month later...

i knew i was missing something!

thanks for the "multiple file unzipping tip", and an aclaration, works for tar also!

 

now the contrib:

 

to make things easy, if you want to run, lets say:

tar xvfz filename.tar.gz

 

you could use an alias, such as ugz (or whatever fits you, while its not an existing command) by editing $HOME/.bashrc and adding:

 

alias ugz='tar xvfz'

 

This can be edited to any kind of command also, for ex. for bz2 files, instead of tar xvfj ... you could use ubz2... thats it.

 

 

i know its not much, but i found it to be quite practical when building the LFS system...

Link to comment
Share on other sites

  • 2 weeks later...

mmmm....

 

i dont know why.. but now its not working with tar...:cry:

 

please help? :roll:

 

 

i want to unpack lots of skinz for GKrellm and i wont be doing that manually, also tryed using a list:

tar xvz --from-file skins

 

didnt worked... dont know why either...

Link to comment
Share on other sites

Guest GorGor

umm, don't mean to be mean, heh heh

 

I prefer to write the above commands this way, notice its either a J or Z (without hyphen) and then the string XVF

 

tar jxvf file.tar.bz

tar zxvf file.tar.gz

 

Because normal TAR s are done with

 

tar xvf file.tar

 

 

hope that helps

Link to comment
Share on other sites

Hi,

 

I think you didnt understand the message ;)

 

I will explain my self a bit better.

 

The command you name (tar XVFZ) its for eXtract, Verbose, File, gZipped (the caps are for each option after tar).

Thats why it doesnt work with multiple files, because i dont want to extract a single File, but several so i have to use a list or other method wich i dont know.

 

when i say, now its not working with tar, refer to this:

 

 

 

hope someone gets what i mean and has a solution.

 

 unzip '*.zip'

 

but ussing tar instead of a zip file:

tar xvz '*.gz'

Link to comment
Share on other sites

I can tell you why it doesn't work but I ll have to think to provde a way to do it.

 

I sucspect you realise anyway....:wink:

 

tar takes input from the $1, not stdinput.

 

try it

tar cvf

 

It doesn't wait to be fed input terminated by CTRL+D

 

While this sounds like a weakness for unix you need to remember that tar is really a tape archiver.

 

Consider the implications of reading from a tape who's contents are unknown. It might be one long tar or several seperate ones.

 

The expansion of *.tar has no meaning to the tape, it just reads blocks.

 

tar xvf /dev/rmt/1 . (read/extract the first tar from a device rmt/1) or in linux /dev/st1)

In fact the extension has no meaning....the tape is a pure block device with no filesystem, the tar encapsulates the original filesystem and allows you to store the files on a tape. The file has no name becuase the tape has no filesystem.

 

After its done that it will stop,

Repeating tar xvf /dev/rmt/1 . will read the next set of blocks up to the EOF's.

 

Not only that....

Imagine your sat at an SGI running IRIX with a XFS filesystem and you create the tar file ...

 

Then you sit at another workstation running Solaris with UFS, linux with ext3 or AIX with jfs....or Beos or BSD .....

 

The files are still extracted perfectly onto the host filesystem.

 

Isn't that beautiful ????

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...