cancel
Showing results for 
Search instead for 
Did you mean: 

Tar the file

 
Highlighted
gany59
Regular Advisor

Tar the file

Hi folks,

I have the file in the /var more than 2 Gb, so i need to tar the file and then gzip the file, because the /var is 100%... Actually the file name is /var/opt/net/compas/180909.. this was the example of the file name.. so to doing the tar and then zip waht is the task i need to carry on this...

Thanks in advance
7 REPLIES 7
Highlighted
Steven Schweda
Honored Contributor

Re: Tar the file

These forums have a "search" feature, and a
search for keywords like, say,
tar gzip
should find many examples in old threads.
Highlighted
R.K. #
Honored Contributor

Re: Tar the file

Hi Gany,

You can try this:

# tar cvf /destination/file1.tar /var/opt/net/compas/file1
# gzip -c file1.tar > file1.gz

Mention full path to avoid any confusion.
Don't fix what ain't broke
Highlighted
Torsten.
Acclaimed Contributor

Re: Tar the file

Why tar first? Just gzip it!

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Highlighted
Michal Kapalka (mikap)
Honored Contributor

Re: Tar the file

hi,

using tar on one file, i don't see any reason.

use gzip as Torsten said.

mikap
Highlighted
Steven Schweda
Honored Contributor

Re: Tar the file

> Why tar first? [...]

1. Preserve the original file.

2. Preserve the file's attributes (owner,
permissions, ...)

> # tar cvf /destination/file1.tar /var/opt/net/compas/file1
> # gzip -c file1.tar > file1.gz

When disk space is a problem, using a
pipeline seems less likely to cause problems.
As I said, examples abound.
Highlighted
Torsten.
Acclaimed Contributor

Re: Tar the file

OK, valid reasons.

But if var is already at 100% consider to create the tar somewhere else!

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Highlighted
V. Nyga
Honored Contributor

Re: Tar the file

Yes - neither tar nor gzip will work in the current directory - it's FULL!
HP-UX will not delete this file during tar or zip ...

What's about /var/tmp - there's rarly a file you'll need ... you can delete here almost everything.

Volkmar
*** Say 'Thanks' with Kudos ***