I have been searching for an answer on this one for a while, the examples I have found do not work.
The file was created as follows:
1. tar cvf home.tar *
2. compress -v home.tar
Resulting in home.tar.Z
I have tried:
tar -zxf home.tar.Z
tar -zxvf home.tar.Z
I have read through Solaris 10 System Essentials. And so far all the web sites I have visited have this one of the two variations of the syntax, mostly the latter. Yet TAR returns a usage error
"tar: z: unknown function modifier
Usage: tar {c|r|t|u|x}[BDeEFhilmnopPqTvw@[0-7]][bfk][X...] [blocksize] [t arfile] [size] [exclude-file...] {file | -I include-file | -C directory f ile}..."
I am pretty new to Solaris and the unix environment. I am getting better but I need some help to extract and decompress this file with one command.
Thank you.
13 Replies - 5953 Views - Last Post: 14 April 2012 - 02:38 AM
#1
Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 09 April 2012 - 07:03 PM
Replies To: Extract and Uncompress tar.Z file, One Command (Solaris)
#2
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 09 April 2012 - 07:07 PM
I've not seen that 'compress' issued before. Most often people download what is called a tar-ball, & it's a tar file that has been compressed with gzip. Issuing the dash z option to tar says to unzip the file first, & then proceed with the untar. The dash z works with gzip compressed files. Also they are named with a .tgz file extension.
I can't say one way or another with absolute certainty. But I would think that what you are trying to do is not possible by using a file from the output of compress.
I can't say one way or another with absolute certainty. But I would think that what you are trying to do is not possible by using a file from the output of compress.
#3
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 09 April 2012 - 07:11 PM
You can use uncompress but I would rather use gzip than compress considering it's a tad more universal and that'll give you the extra options for a one-liner.
The file would be file.tar.gz
create:
tar -czvf archivename.tar.gz filetocompress
uncompress:
tar -zxvf archivename.tar.gz
The file would be file.tar.gz
create:
tar -czvf archivename.tar.gz filetocompress
uncompress:
tar -zxvf archivename.tar.gz
This post has been edited by Lemur: 09 April 2012 - 07:14 PM
#4
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 09 April 2012 - 07:24 PM
I appreciate the fast response. I only know that this is possible because this is homework, this is the last step. I was able to work through 1-7, but I am stuck on this one. The Compress command came from Linux and Unix Compress Cmd, there is of course an uncompress cmd. My peers used the Compress cmd.
So as I now understand unlike Windows, linux, unix and solaris, the concept of extract and uncompress are two seperate, but related, concepts/commands??
So as I now understand unlike Windows, linux, unix and solaris, the concept of extract and uncompress are two seperate, but related, concepts/commands??
#5
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 09 April 2012 - 07:25 PM
Maybe the assignment is to build a script? Thus you pass it two parameters, one indicated compress or uncompress, & the 2nd indicating the file name?
#6
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 09 April 2012 - 07:26 PM
And to be clear the file types were dictated to me, eg. home.tar.Z.
#7
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 09 April 2012 - 07:34 PM
It is an overall script, but it is just to capture all the work in one file. Can I use the pipe character to combine the uncompress and tar? I think Catherine (my teacher) idea of one command, has included the '|' in the past.
#8
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 09 April 2012 - 08:48 PM
And please note, I am continuing the search on my own, in conjuction with the forum. I appreciate the help thus far.
#9
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 10 April 2012 - 09:59 AM
uncompress -v home.tar.Z | tar -xvf home.tar
Did the job, I agree with you guys compress is not the way to go.
Did the job, I agree with you guys compress is not the way to go.
#10
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 10 April 2012 - 11:18 AM
Haven't seem compress is a long time...
Note the uncompress -v foo.tar.Z | tar -xvf foo.tar probably isn't doing what you want. There's no real piping going on and tar wasn't told to expect any. If you want to not run command2 unless command1 finishes successfully, use command1 && command2.
You might try:
This should send to uncompress result to stdout and the tar should take it from there. This has the bonus of not messing with the original file.
Note the uncompress -v foo.tar.Z | tar -xvf foo.tar probably isn't doing what you want. There's no real piping going on and tar wasn't told to expect any. If you want to not run command2 unless command1 finishes successfully, use command1 && command2.
You might try:
uncompress -c foo.tar.Z | tar xv -
This should send to uncompress result to stdout and the tar should take it from there. This has the bonus of not messing with the original file.
#11
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 10 April 2012 - 06:29 PM
baavgai, Makes perfect sense, the class linux whiz kid agrees with you that the above cmd is incorrect. That said the teacher did it the way I wrote. She is flexible so I will send this along to her. On a separate but related note, that was the last time I have to open up a Solaris VM. I hate it. I am happy with Mac and linux.
thanks,
diek
thanks,
diek
#12
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 10 April 2012 - 09:18 PM
Then you're not using it correctly. Every operating system has its strengths and its weaknesses. A few examples:
Windows is great for convenience and compatibility but horrid with security
Mac is great for an expensive paperweight but horrid to get anything done with
OpenBSD is great for security and reliability but lord help the guy who tries it as a desktop
Solaris tends to be a more stable database server than most given its file systems and close workings with Oracle.
Windows is great for convenience and compatibility but horrid with security
Mac is great for an expensive paperweight but horrid to get anything done with
OpenBSD is great for security and reliability but lord help the guy who tries it as a desktop
Solaris tends to be a more stable database server than most given its file systems and close workings with Oracle.
#13
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 10 April 2012 - 10:07 PM
Lemur,
Hate was a strong word, maybe painful learning experience better describes it. I see your point. It is solid and dependable, just not a friendly desktop app. And one term working in it was not really enough.
Hate was a strong word, maybe painful learning experience better describes it. I see your point. It is solid and dependable, just not a friendly desktop app. And one term working in it was not really enough.
#14
Re: Extract and Uncompress tar.Z file, One Command (Solaris)
Posted 14 April 2012 - 02:38 AM
Oh trust me, if you try and use most Solaris or OpenBSD type OSs designed for security and reliability on a desktop environment you'll pull out your hair fast. The more security the more rigid the OS. For a server that's great, but for a desktop that can really damper progress to a newer user.
That being said, a high level unix user would have no problems getting OpenBSD to behave quite well as a Desktop OS, but for a learner it would be impossible.
That being said, a high level unix user would have no problems getting OpenBSD to behave quite well as a Desktop OS, but for a learner it would be impossible.
Page 1 of 1
|
|

New Topic/Question


MultiQuote






|