Tuesday, May 26, 2015

Create & Extract tar.gz in Linux



In Linux tar.gz is the is common format for compressed archive. while doing odoo server administration it is required to download the addons from server to local system.

Compress folder/file to compressed archive

Command to compress the folder and files.

tar -czf tar_file_name.tar.gz file_or_folder_to_archive

Here,

  • tar - the tar command.
  • c - create new archive.
  • z - compress the archive using gzip.
  • f - use archive file.
  • tar_file_name.tar.gz - the name of the tar.gz to create.
  • file_or_folder_to_archive - the name of the folder we want to archive.


example of tar command to compress odoo addons

tar -czf odoo_addons.tar.gz addons

Extract folder/file to compressed archive

Command to Extract the compressed archive.

tar -zxvf compressed_file.tar.gz

Here,

  • -z : Work on gzip compression automatically when reading archives.
  • -x : Extract archives.
  • -v : Produce verbose output i.e. display progress and extracted file list on screen.
  • -f : Read the archive from the archive to the specified file. In this example, read backups.tar.gz archive.
  • -t : List the files in the archive.


example to extract the compressed archive.

tar -zxvf odoo_addons.tar.gz

No comments:

Post a Comment