Created
February 8, 2023 15:08
-
-
Save Nav-Appaiya/82696472dbae0a80c645e03467843d9a to your computer and use it in GitHub Desktop.
How to use tar for compression & extraction in linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1: tar (create uncompressed archive) all files and directories in the current working directory recursively into an uncompressed tarball | |
tar cvf filename.tar * | |
# 2: Untar (extract uncompressed archive) all files and directories in an uncompressed tarball recursively into the current working directory | |
tar xvf filename.tar | |
# 3: tar (create gzipped archive) all files and directories in the current working directory recursively into a tarball compressed with gzip | |
tar cvzf filename.tar.gz * | |
# 4: Untar (extract gzipped archive) all files and directories in a tarball compressed with gzip recursively into the current working directory | |
tar xvf filename.tar.gz # Note: same options as 2 above | |
# 5: tar (create bzip2'ed archive) all files and directories in the current working directory recursively into a tarball compressed with bzip2 | |
tar cvjf filename.tar.bz2 * # Note: little 'j' in options | |
# 6: Untar (extract bzip2'ed archive) all files and directories in an tarball compressed with bzip2 recursively into the current working directory | |
tar xvf filename.tar.bz2 # Note: same options as 2 and 4 above | |
# 7: tar (create xz'ed archive) all files and directories in the current working directory recursively into a tarball compressed with xz | |
tar cvJf filename.tar.xz * # Note: capital 'J' in options | |
# 8: Untar (extract xz'ed archive) all files and directories in an tarball compressed with xz recursively into the current working directory | |
tar xvf filename.tar.xz # Note: same options as 2, 4, and 6 above |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment