Firefox 16, a treat for developers http://t.co/cnd27CzT
File compressors in Linux | gzip zip tar
Compressed files use less disk space and download faster than large, uncompressed files. You can compress Linux files with the open-source compression tool Gzip or with Zip, which is recognized by most operating systems.
By convention, compressed files are given the extension .gz. The command Gzip creates a compressed file ending with .gz; Gunzip extracts the compressed files and removes the .gz file.
- To compress a file, at a shell prompt, type the following command:
The file will be compressed and saved as filename.ext.gz.
- To expand a compressed file, type:
The filename.ext.gz is deleted and replaced with filename.ext.
- If you exchange files with non-Linux users, you may want to use zip to avoid compatibility problems. Linux can easily open zip or gzip files, but non-Linux operating systems may have problems with gzip files.
- To compress a file with zip, type the following:
zip -r filename.zip files
In this example, filename represents the file you are creating and files represents the files you want to put in the new file:
- To extract the contents of a zip file, type:
You can zip or gzip multiple files at the same time. List the files with a space between each one.
gzip filename.gz file1 file2 file3 /user/work/school
The above command will compress file1, file2, file3, and the contents of the /user/work/school directory and put them in filename.gz.
Archiving with Tar
- Tar files place several files or the contents of a directory or directories in one file. This is a good way to create backups and archives. Usually, tar files end with the .tar extension.
- To create a tar file, type:
tar -cvf filename.tar files/directories
In this example, filename.tar represents the file you are creating and files/directories represents the files or directories you want to put in the new file.
You can use absolute or relative pathnames for these files and directories. Separate the names of files and directories with a space.
The following input would create a tar file using absolute pathnames:
tar -cvf foo.tar /home/mine/work /home/mine/school
The above command would place all the files in the /work subdirectory and the /school subdirectory in a new file called foo.tar in the current working directory.
The command tar -cvf foo.tar file1.txt file2.txt file3.txt would place file1.txt, file2.txt and file3.txt in a new file called foo.tar.
To list the contents of a tar file, type:
tar -tvf foo.tar
To extract the contents of a tar file, type:
tar -xvf foo.tar
This command does not remove the .tar file, but it places copies of the .tar contents in the current working directory.
The tar command does not compress files automatically. You can compress tar files with:tar -czvf foo.tar
Compressed tar files are conventionally given the extension .tgz and are compressed with gzip.
To expand a compressed tar file type:tar -xzvf foo.tgz
Usefull links : http://www.redhat.com
Related Articles By Tags :
Like us on Facebook
This week Top Posts
- Top Things to do After Installing Ubuntu 13.04 ‘Raring Ringtail’ : Ubuntu 13.04 Raring Ringtail final is almost out. The final release it scheduled for release on Apri...1 comment(s) |
- Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comment(s) |
- Howto: Upgrade to Ubuntu 13.04 Raring Ringtail from 12.04, 12,10 | Desktop & Server : Updated 05-04-2013: Ubuntu 13.04 Raring Ringtail will be released Soon, If you have ubuntu 12,10, 12...0 comment(s) |
- Install and Configure Samba share in Ubuntu 13.04 Raring Ringtail , 12.10, 12.04| Howto : Updated 05-04-2013: One of the most asked features for Samba is a graphical user interface to help w...0 comment(s) |
- How to use Remote Desktop in Ubuntu : Sometimes, we need to access our computer from other locations when we’re not at home and such. This...0 comment(s) |
- Configure conky-Lua in Ubuntu (12.10 & 13.04 Raring Ringtail), Fedora, debian and LinuxMint | Howto Conky : Updated 05-04-2013: Conky is a free, light-weight system monitor for X, that displays any informatio...0 comment(s) |
- Dictionaries in Python
- How to Install uTorrent Client on Ubuntu/Debian/Linux Mint
- Lists in Python
- Argument Handling in Python
- Setup your own Wikipedia like website using MediaWiki
- Administer your Server using Ajenti Server Manager
- “Brand New” Unixmen Forum is Now Live!
- How To: Disable or Enable Guest Account in Ubuntu 13.04
- Setup Your Own YouTube Like Website Using ClipBucket
- Retroshare: A Next Generation Secure Communication and File Sharing Platform
Copyright © 2008-2013 Unixmen.com .