- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- tar and gunzip mutiple files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-27-2010 11:38 PM
тАО12-27-2010 11:38 PM
tar and gunzip mutiple files
In one of my server /var is 95%. so i find out the old log files in /var/adm/sa. some 100 log files are there in the name like sa1 sa2 sa3.
so how can i tar all those files into a single file and gzipped that one.
Please let me know.
Thanks in advance!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-27-2010 11:45 PM
тАО12-27-2010 11:45 PM
Re: tar and gunzip mutiple files
# cd /var/adm/sa
# tar -cvf - * | gzip -9 -c > directory.tgz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-28-2010 05:58 AM
тАО12-28-2010 05:58 AM
Re: tar and gunzip mutiple files
What didn't you like? If you want a more
detailed answer, then you might try starting
with a more detailed question.
> # cd /var/adm/sa
> # tar -cvf - * | [...]
I'd probably do it differently:
cd /
tar -cf - var/adm/sa | [...]
That way I wouldn't forget whence the files
came originally. But I don't know exactly
which files you wish to archive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-28-2010 06:05 AM
тАО12-28-2010 06:05 AM
Re: tar and gunzip mutiple files
You need to be careful about using "*" and then writing to a file in the same directory. You'll get a tar feedback loop. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-28-2010 07:31 AM
тАО12-28-2010 07:31 AM
Re: tar and gunzip mutiple files
That is right, thank you Dennis for heads up .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2010 02:12 PM
тАО12-29-2010 02:12 PM
Re: tar and gunzip mutiple files
use the
tar -czvf /mount-withfreespace/filename.tar.gz /var/adm/sa*
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2010 04:39 PM
тАО12-29-2010 04:39 PM
Re: tar and gunzip mutiple files
There's a reason I suggested:
cd /
tar -cf - var/adm/sa [...]
instead of:
tar -cf - /var/adm/sa [...]
One is easier to extract to a non-original
location.