As compress an entire directory on Linux or Unix
If you need to do backups, mail all files or even to send software we've developed is very easy to do if you compress and pack the directory or folder where all our information. To this end we have the tool GNU tar, which can be used from a remote station in a Linux or UNIX server.
The tar command does two things:
- Packaging folders within a file
- Compress the file
The tar command is used as follows (syntax of the command tar):
tar-zcvf archivo_nuevo.tar.gz nombre_directorio
Where,
- -z: Compress the file using the gzip
- -c: Create a file
- -v: Verbose Mode, it displays the progress while creating the file
- -f: File Name
Let's say we have a directory named / home / user / documents and we need to make a backup copy of the documents. To execute this tar command like this:
user @ deathbian: ~ $ tar-zcvf copia_mis_documentos_2008.tar.gz / home / user / documents
The above command created a file called copia_mis_documentos_2008.tar.gz within the current directory. However, if you already have a directory with all the files packaged but we need to restore or unpack the files, type:
user @ deathbian: ~ $ tar-zxvf copia_mis_documentos_2008.tar.gz
Where,
- -x: Extract files
If you need to extract the files to a different directory can add the full path to that directory at the end of the command, typing:
$ Tar-zxvf copia_mis_documentos_2008.tar.gz-C / backups
Popularity: 1% [?]
Trackback URI | Comments RSS






