Skip to content

Instantly share code, notes, and snippets.

@dungdm93
Created February 14, 2020 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dungdm93/17db818a73048a012a5252fc51f5a8bb to your computer and use it in GitHub Desktop.
Save dungdm93/17db818a73048a012a5252fc51f5a8bb to your computer and use it in GitHub Desktop.

tar

# extract
tar -xvf archive.tar

# List files in archive.tar
tar -tvf archive.tar

# compress
tar -cvf  archive.tar foo bar
tar -czvf archive.tar foo bar # z = compress with gzip

gz (gzip)

# compress
gzip   file     # compress FILES in-place => file.gz
gzip -k file    # keep (don't delete) input files

# extract
gzip -d file.gz
gunzip  file.gz

bz2 (bzip2)

# compress
bzip2  file     # compress FILES in-place => file.bz
bzip2 -k file   # keep (don't delete) input files

# extract
bzip2 -d file.bz2
bunzip2  file.bz2

zip

# compress
zip archive.zip file1 file2
zip -r archive.zip folder1 folder2 folder3

# extract
unzip archive.zip

# list
unzip -l archive.zip
@dungdm93
Copy link
Author

ref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment