How to rename .tar.gz file without extracting the contents and creating the new .tar.gz file in UBUNTU?

11,902

The easiest is to simply rename ("move") the file:

mv Existing.tar.gz New.tar.gz
Share:
11,902

Related videos on Youtube

Madhu
Author by

Madhu

Here to ask loads of questions and clear my doubts!!

Updated on June 04, 2022

Comments

  • Madhu
    Madhu almost 2 years

    I have a command which will create a new .tar.gz file from the existing one,

     sudo tar -zcvf Existing.tar.gz New.tar.gz
    

    this command will create a new New.tar.gz file from the existing Existing.tar.gz file.

    Can anyone tell me, is there any way to rename the exiting file without creating the new one?

    Thanks.

    • arkascha
      arkascha almost 7 years
      What about mv Existing.tar.gz New.tar.gz ?
    • arkascha
      arkascha almost 7 years
      And, btw, that command you gave does not unpack anything... It will try to create an archive Existing.tar.gz and place the file New.tar.gz in it... Which certainly is not what you want.
  • Madhu
    Madhu almost 7 years
    Thank you. this rename the existing file like how I wanted.
  • arkascha
    arkascha almost 7 years
    Sure, you are welcome. And maybe a "pro tip" for you: take a look at the apropos utility: it allows you to discover commands you do not already know, so here the mv command. Try a apropos rename and look through the result list. For each of those commands you can open the manual page with the man utility, so here a man mv to find out about the commands usage and details...
  • arkascha
    arkascha almost 7 years
    Glad I could be of help! Then maybe you want to "accept" this answer ;-)