Ir al contenido
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Inicia sesión
  • Nederlands English (US) Español (AR)
  • Contáctanos
  • Inicio
  • Blog
  • Empleos
  • Contáctanos
Cafayate.Net
  • 0
  • 0
    • Inicio
    • Blog
    • Empleos
    • Contáctanos
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Inicia sesión
  • Contáctanos

How do I Compress a Whole Linux or UNIX Directory?

  • Todos los blogs
  • Tech Blog
  • How do I Compress a Whole Linux or UNIX Directory?
  • 5 de marzo de 2021 por
    Administrator

    It is very easy to compress a Whole Linux/UNIX directory. It is useful to backup files, email all files, or even to send software you have created to friends. Technically, it is called as a compressed archive. GNU tar command is best for this work. It can be use on remote Linux or UNIX server. It does two things for you:

    => Create the archive

    => Compress the archive

    You need to use the tar command as follows (syntax of tar command):
    tar -zcvf archive-name.tar.gz directory-name
    Where,

    • -z : Compress archive using gzip program
    • -c: Create archive
    • -v: Verbose i.e display progress while creating archive
    • -f: Archive File name

    For example, say you have a directory called /home/jerry/prog and you would like to compress this directory then you can type tar command as follows:
    $ tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog
    Above command will create an archive file called prog-1-jan-2005.tar.gz in current directory. If you wish to restore your archive then you need to use the following command (it will extract all files in current directory):
    $ tar -zxvf prog-1-jan-2005.tar.gz
    Where,

    • -x: Extract files

    If you wish to extract files in particular directory, for example in /tmp then you need to use the following command:
    $ tar -zxvf prog-1-jan-2005.tar.gz -C /tmp
    $ cd /tmp
    $ ls -

    A note about non gnu/tar command

    The above syntax use GNU tar command for compressing and uncompressing tar files. If your system does not use GNU tar, you can still create a compressed tar file, via the following syntax:
    tar -cvf - file1 file2 dir3 | gzip > archive.tar.gz

    en Tech Blog
    How to setup multiple websites in Odoo V8

    Diseñado para empresas

    Somos un equipo de personas apasionadas cuyo objetivo es mejorar la vida de todos a través de productos revolucionarios. Creamos grandes productos para resolver sus problemas empresariales. Nuestros productos están diseñados para pequeñas y medianas empresas dispuestas a optimizar su rendimiento.

    Contáctenos

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Síganos
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)