You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This article covers how to Tar Untar and Zip Files.

[paragraph]These commands can be run from within SSH to tar or untar a tarball file. These files are typically used in packaged backups or a directory that has been compressed.[/paragraph]

[headline]Tar[/headline]

[paragraph]These commands will compress the selected directory into a tarball file, which will be located within the original directory.[/paragraph]

[code description="To compress a directory into a tar file (.tar):"]tar -xvf FILENAME.tar DIRECTORY/[/code]

[code description="To compress a directory into a gzip tar file (.tgz or .tar.gz):"]tar -czvf FILE.tar.gz DIRECTORY/[/code]

[code description="To compress a directory into a bzip2 tar file (.tbz or .tar.bz2):"]tar -jxvf FILE.tar.bz2 DIRECTORY/[/code]

[headline]Untar[/headline]

These commands will extract the tarball file into the current directory it is located in.

[code description="To uncompress a tar file (.tar):"]tar xvf FILE.tar[/code]

[code description="To uncompress a gzip tar file (.tgz or .tar.gz):"]tar xvzf FILE.tar.gz[/code]

[code description="To uncompress a bzip2 tar file (.tbz or .tar.bz2):"]tar xvjf FILE.tar.bz2[/code]

[headline]Zip and Unzip[/headline]

[code description="To compress the selected directory into a zip file, which will be located within the original directory:"]zip -r fFILE.zip DIRECTORY/[/code]

[code description="To extract the selected zip file, which will be uncompressed into the directory the zip is located in:"]unzip FILE.zip[/code]

[headline]Additional Notes[/headline]

If you wish to extract the tarball file to a specific directory, adding the following to the end of the command will extract it to the specified location:

[code description=""]-C /DIRECTORY/[/code]
  • No labels