LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 03-27-2021, 07:28 PM   #16
claire80
LQ Newbie
 
Registered: Mar 2021
Posts: 11

Original Poster
Rep: Reputation: Disabled

Got the compression of the file now but is there a command to change the name of the original command to a different name during compression of the file. I have tried to find the solution but can't find one that does it at the same time of compression.
 
Old 03-27-2021, 09:01 PM   #17
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
use a 2 line shell script.
the first line will do the compression (I assume you use gzip -- or even tar as you had in your earlier post)
the second line can rename the compressed file.

If you are doing more than one file then the script can handle that as well with a for or while loop as it reads the original file names and compresses them.

Last edited by computersavvy; 03-27-2021 at 09:03 PM.
 
Old 03-27-2021, 09:18 PM   #18
claire80
LQ Newbie
 
Registered: Mar 2021
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thank you again. Will definitely get it this time.
 
Old 03-28-2021, 05:35 AM   #19
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Another possibility is described in the GNU Gzip manual
Code:
gzip -c uncompressed_file >compressed_file.gz
 
1 members found this post helpful.
  


Reply



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
I'm not sure how this happened but I'm sure there is a lesson in there somewhere mreff555 Linux - Newbie 6 09-24-2012 02:09 AM
(imagemagick)why this command can not compress png image... kingliang123 Linux - Software 4 01-12-2011 08:45 PM
read/write,write/write lock with smbclient fails swatidas11 Linux - Networking 1 03-10-2010 12:27 PM
compress command does not work sky rulz Linux - Newbie 2 08-18-2009 12:03 AM
lp command with compress mode zita Linux - General 2 10-06-2005 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:08 PM.

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
Open Source Consulting | Domain Registration