detect if file is bzip compressed on solaris 10


 
Thread Tools Search this Thread
Operating Systems Solaris detect if file is bzip compressed on solaris 10
# 1  
Old 09-22-2011
detect if file is bzip compressed on solaris 10

Hi, I recently tried to create a tar archive on a Solaris 10 machine with gnu tar 1.17 and I used the command gtar -cjf filename.tar file1 file2 directory.
The creation was successful but I'm not sure if the file was compressed with bzip as the j option is supposed to do. How can I check that it was compressed?
I have tried the command gtar -tf filename.tar and it lists all files but it doesn't say anything about compression (I left out the j option on purpose to see if gtar would protest)

When I created the archive I thought that the j option would add the .bz2 extension to the file name but it didn't so now I'm confused...Smilie

---------- Post updated at 01:52 PM ---------- Previous update was at 01:45 PM ----------

Hmm, found the solution myself...
I ran bunzip2 filename.tar and it didn't protest about file format (it warned about not being able to guess original file name).
Then I tried bunzip2 somefile.txt and got the message
bunzip2: somefile.txt is not a bzip2 file.

Conclusion: my tar archive was compressed but the file name didn't reflect this and gtar can read a compressed archive even though I don't specify how it is compressed.
# 2  
Old 09-22-2011
perhaps simpler way would be to take a peek at file header.
I think there should be hex viewer in Solaris or something similar to do it.
This User Gave Thanks to orange47 For This Post:
# 3  
Old 09-22-2011
use the "file" utility to check the file header. example:
Code:
$ file V26755-01.zip 
V26755-01.zip: Zip archive data, at least v1.0 to extract

this was done on mac os but is similar on solaris.
This User Gave Thanks to DukeNuke2 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Solaris can't detect external HDD on HP server

Hello, Unix users :) Has anyone had this problem when you connect an external hard drive to the server and it is simply not visible with any commands? The server is HP DL380 g8, and OS is: root@...:/# cat /etc/release Oracle Solaris 10 8/11 s10x_u10wos_17b X86 ... (16 Replies)
Discussion started by: Aratai
16 Replies

2. Shell Programming and Scripting

compressed file

i have a file 4d7a94d0.bbb.1292 when i do file 4d7a94d0.bbb.1292 the ouput is below 4d7a94d0.bbb.1292: gzip compressed data - deflate method and i run this command gunzip -c 4d7a94d0.bbb.1292 | awk '{gsub("\"","")}/I_ACCOUNT_ID/{print $2}' RS=":|;" FS="," i get... (3 Replies)
Discussion started by: blackzinga80
3 Replies

3. Solaris

How to detect / scan vtls on solaris 10

Hello Admins. I just have a doubt that how we can scan the VTLs ( virtual tape libraries ) on solaris 10. I have an idea that we can find the VTL's in /dev/scsi/changer ...directory.. is that the correct location? Also how to detect the new ones attached.... Thanks (0 Replies)
Discussion started by: snchaudhari2
0 Replies

4. Shell Programming and Scripting

Process a compressed file

Hi i have a filename.tar.bz2 and i have to parse it with a tool that doesn't support compressed files. I have to do it for many big files, so i can't decompress and then process. I'd like to do something like: tar -jxvf namefile.tar.bz2 | parsing_tool i mean analyze it directly,... (4 Replies)
Discussion started by: Dedalus
4 Replies

5. Programming

Uncompress a gzip and bzip file using java on unix solaris environment

Hi, I need to uncompress a gzip and bzip file using java on unix solaris environment. I also need to retreive the header information of the file inorder to differentiate between gzip and bzip file. Please help Pooja (0 Replies)
Discussion started by: wadhwa.pooja
0 Replies

6. UNIX for Dummies Questions & Answers

compressed file

I compressed a file by using gzip command gzip <<xx>> filename changed to xx.gz How to view this xx.gz file. Any idea. Thanks in advance. (7 Replies)
Discussion started by: venkatesht
7 Replies

7. UNIX for Advanced & Expert Users

Is it possible to see the content of the compressed file?

How we can view the content of the file,if it compressed (or) Zipped ,without uncompress ? I have one file ,i compressed it,without uncompressing the file.Is it possible to see the content of the file? (2 Replies)
Discussion started by: bobprabhu
2 Replies

8. Solaris

Solaris 9 on x86- Can't detect network interface

Hi All, I recently installed Solaris 9 on my Compaq Presario V2000 Series (V2069CL) laptop. Everything is working fine except that Solaris is not able to detect the Network Interface after boot. While the system is booting, it shows that it has detected "Xircom Pocket Ethernet parallel port... (3 Replies)
Discussion started by: com2com
3 Replies

9. Shell Programming and Scripting

Check if file compressed or not

Is there a way I can check if a file is comppressed or not? (Be it tar/gzip or compress). trying to write a generic housekeeping scrit that will delete files over 6 months old and compress any uncompressed files if less than 6 months old. But not sure if there is a clever way to check except for... (4 Replies)
Discussion started by: badg3r
4 Replies

10. UNIX for Dummies Questions & Answers

Not able to detect nr of cpu in Solaris System

Hello, how can I detect the nr of cpu of my SUN E250 Solaris server? I have tryed with top but I was not able to find the information. Thanks. (1 Reply)
Discussion started by: pbonato
1 Replies
Login or Register to Ask a Question