View the Most Wanted LQ Wiki articles.
LinuxQuestions.org > Linux Wiki > Packing and Unpacking Files

From LQWiki

(Redirected from Pack)
Jump to: navigation, search

Packing files

To pack means to unite several files in one file, called an archive. Typical commands for packing under Linux are

  • zip -- for .zip files

Example:

zip -r targetfile sourcedirectory
  • tar -- for .tar and .tar.gz files

Example (creates a .tar.gz file):

tar cvzf targetfile.tar.gz sourcedirectory
  • bzip2 -- for .bz2 files

Example:

bzip2 sourcefile

Unpacking files

How to unpack files depends on their suffix:

  • .tar.gz

unpack with the command

tar xvzf archive.tar.gz

where archive is the archive's name without suffix

  • .tar

unpack with the command

tar xvf archive.tar

where archive is the archive's name without suffix

  • .zip

unpack with the command

unzip archive.zip

where archive is the archive's name without suffix

  • .bz2

unpack with the command

bunzip2 archive.bz2

where archive is the archive's name without suffix

  • .rar

unpack with the command

unrar x archive.rar

where archive is the archive's name without suffix


Personal tools