LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2010, 02:09 PM   #1
pnmanojshenoy
Member
 
Registered: Jun 2008
Location: Cochin, India
Distribution: Debian,Ubuntu
Posts: 38

Rep: Reputation: 0
Script to compress


Hello,

Can some one help me to write a script to compress any file with 10 MB size to tar.gz

Say /var/log/tes directory has a file with 10 MB I want it to compress to tar.gz

Thanks
 
Old 06-07-2010, 02:19 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,933

Rep: Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692
Quote:
Originally Posted by pnmanojshenoy View Post
Hello,
Can some one help me to write a script to compress any file with 10 MB size to tar.gz

Say /var/log/tes directory has a file with 10 MB I want it to compress to tar.gz
Thanks
We will be glad to help you. Post what you've written so far, and where you're having problems. However, we are not going to write your script for you.

There are many bash scripting tutorials on the web, that you can easily find. As a hint, read the man pages for the find and tar commands, as they will give you all the info you need to find the files, and compress them. Use the pipe " | " to chain commands together.
 
Old 06-07-2010, 02:26 PM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
You may want to take a look at the logrotate command. I think it will do what you want.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
script to compress a directory and then delete older than 7 days replica88 Linux - General 3 02-03-2010 08:21 PM
How to make/configure script to extract, ecit and compress initrd.gz ?? linus72 Linux - General 14 10-22-2009 07:31 PM
script needed to compress files kingkhankk Linux - General 2 03-04-2008 12:20 PM
compress fs alaios Linux - General 5 09-07-2004 09:29 PM
compress Ownasaurus Linux - Software 4 09-12-2003 08:17 PM


All times are GMT -5. The time now is 08:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration