miércoles, julio 17, 2013

Linux:Compresores de Archivos

TAR: Compresor de archivos
[root@localhost ~]# tar cvf backuptar.tar anaconda-ks.cfg install.log install.log.syslog
anaconda-ks.cfg
install.log
install.log.syslog
[root@localhost ~]# ls -l
total 224
-rw-------. 1 root root   1609 jun 27 10:57 anaconda-ks.cfg
-rw-r--r--. 1 root root  61440 jul 17 21:29 backuptar.tar
-rw-r--r--. 1 root root  45518 jun 27 10:57 install.log
-rw-r--r--. 1 root root  10565 jun 27 10:55 install.log.syslog
[root@localhost ~]# tar tvf backuptar.tar
-rw------- root/root      1609 2013-06-27 10:57 anaconda-ks.cfg
-rw-r--r-- root/root     45518 2013-06-27 10:57 install.log

Para descomprimir tar -xvf backuptar.tar


GZIP: A diferencia de tar, comprime y absorve el archivo comprimido.

[root@localhost ~]# gzip anaconda-ks.cfg install.log install.log.syslog
[root@localhost ~]# ls -l
total 44
-rw-------. 1 root root   977 jun 27 10:57 anaconda-ks.cfg.gz
-rw-r--r--. 1 root root 10475 jun 27 10:57 install.log.gz
-rw-r--r--. 1 root root  1602 jun 27 10:55 install.log.syslog.gz
[root@localhost ~]# gunzip anaconda-ks.cfg.gz
[root@localhost ~]# ls -l
total 44
-rw-------. 1 root root  1609 jun 27 10:57 anaconda-ks.cfg
-rw-r--r--. 1 root root 21454 jul 17 21:20 backup.tar.gz
-rw-r--r--. 1 root root 10475 jun 27 10:57 install.log.gz
-rw-r--r--. 1 root root  1602 jun 27 10:55 install.log.syslog.gz

TAR + GZIP: Comprimiendo varios archivos en un backup.tar.gz

[root@localhost ~]# ls -l
total 68
-rw-------. 1 root root  1609 jun 27 10:57 anaconda-ks.cfg
-rw-r--r--. 1 root root 45518 jun 27 10:57 install.log
-rw-r--r--. 1 root root 10565 jun 27 10:55 install.log.syslog
[root@localhost ~]# tar czvf backup.tar.gz anaconda-ks.cfg install.log install.log
anaconda-ks.cfg
install.log
install.log
[root@localhost ~]# ls -l
total 92
-rw-------. 1 root root  1609 jun 27 10:57 anaconda-ks.cfg
-rw-r--r--. 1 root root 21454 jul 17 21:20 backup.tar.gz
-rw-r--r--. 1 root root 45518 jun 27 10:57 install.log
-rw-r--r--. 1 root root 10565 jun 27 10:55 install.log.syslog
[root@localhost ~]# tar -tvf backup.tar.gz
-rw------- root/root      1609 2013-06-27 10:57 anaconda-ks.cfg
-rw-r--r-- root/root     45518 2013-06-27 10:57 install.log
-rw-r--r-- root/root     45518 2013-06-27 10:57 install.log

Para descomprimir tar -xzvf backup.tar.gz

No hay comentarios: