Leanne Leith wrote:
> Okay, I successfully gunzipped some tar.gz files, now I can't access the sub-folders
>in them. I tried to use tar -zvf without luck, and tar -z all sorts of other
>combinations. what am I doing wront?
>
> Not enough hours in the day to learn all this stuff!
Hours are required, but reading documentation and maybe a good book, like Linux in a
Nutshell, or Unix in a Nutshell, and Essential Systems Administration, would surely be
very helpful. Take the book
where ever you go and when you have time, then read.
You'ld find this would make a major difference with respect to the learning curve.
However, I don't know why you're applying z in the options to tar. To extract, use x.
If you're not trying to extract, then what are you trying to do?
I'm not sure what you mean by sub-folders. Are you talking about directories or files?
Directories are files in Linux and Unix, because everything is a file in Linux
and
Unix, but here I mean directories and files as per the more common
understanding.
Do you want to extract the entire contents of the archive, or only some directories
and or files, but not all?
Assuming you want to extract the entire contents of the archive, the following
explains how to do this. If you only want to extract some, then we'll wait for your
response.
Complete extraction:
Suppose you have file xxxx.tar.gz. To untar this, do the following:
gunzip xxxx.tar.gz
or, if it's the only .gz file in the directory, then simply
gunzip *.gz
Then, to untar, do
tar xvf xxxx.tar
or, if it's the only .tar file in the directory or you want all .tar files in the
directory untar'd, then
tar xvf *.tar
That's x (for e-x-tract), instead of z.
Be careful with these steps, though. At the gunzip level, if you have another
xxxx.tar file in the directory and it's not the same, then you could clobber that file
by gunzip'ing the .gz one.
Similarly, untar'ing a .tar could clobber files.
You need to be aware of this and where you're uncompressing and untar'ing.
One thing you can do once the file is unzipped or uncompressed is to run tar with the
options tvf
tar tvf
(maybe tf would be adequate, but I have no need to worry about the effects of v and
therefore always use it to ensure verbose output).
This lists the contents of the .tar file, like a toc (table of contents).
When you use tvf, check the directory paths of the files in the archive. The paths
will either be absolute or relative.
If the directory paths are relative, then you could create a temporary directory, copy
the .tar file to this directory and untar the file there. Then, you can examine the
files there, or copy them to
where you want them.
This probably wouldn't be bad practice at first, for people who haven't used tar
before. Once you're comfortable with the tool, then you'll be more sure of what
you're doing when you extract in
directories where existing files might get clobbered (overwritten or replaced).
If the directory paths of the files in the archive are absolute, then it doesn't
matter where you are, that's where the extraction will place those files. However,
there may be a tar option to force
local extraction, even in this case, instead of by the absolute paths (I think there
is, but will let you check, if this is relevant to your task).
Check the tar man page for this
man tar
You need to get used to man; therefore, might as well give it a try, now, before
actually doing any extraction. (Of course, that's assuming man and the man pages are
installed, which you'll immediately
find out when you run man for tar. Should be installed. If not, then install the man
pages - probably the man-*.rpm file.)
If you don't use an option to force local extraction for an archive in which the paths
of the files are absolute, then that's where the files will go, and you need to be
sure that any files already
existing in those paths and included in the archive, if clobbered, will be what you
want for the result (replacement).
There's probably a tar option for prompting on a file by file basis, that is, for the
files being extracted and for which there's already a "copy" or instance in the paths
the files will be extracted
to. Check the man page for tar.
It's very simple; therefore, don't panic and just read carefully without being so
nervous that you make understanding more difficult. People seem to sometimes let
their nerves get the better of them.
Be calm and read carefully.
There's no need to panic, until it's too late, and by then, it's probably too late to
bother wasting energy panicing anyway. If you're not working on a critical system,
then take mistakes as part of the
learning curve, graciously, and, while you're at it, gratuitously. If, however,
you're working in a mission critical environment or on a mission critical system, then
tell your boss he or she is an
idiot.
Joking.
If working on a mission critical system, which I seriously doubt, on which you must
absolutely not clobber anything, then just read the man page thoroughly and carefully,
before executing the
extraction. The options are sufficiently spelled out for all of the above cases.
If you need to take a walk and get a drink, for a few minutes to digest this, then do
so, before starting. Then read again, carefully, and advance with confidence. You
won't blow up the machine.
If you're afraid of making mistakes, then don't be; it's important to be calm, cool,
confident, to read, and proceed, carefully, but without being a nervous wreck about
it.
Be cool (not kool, just cool).
If you're just starting out with computers, then calm down, do some reading,
probably with a couple of the books mentioned, like Linux in a Nutshell and Essential
Systems Administration, and be
[patient].
mike