Nav

File Compression Commands

Edit me

File Compression

  • tar zcvf archive.tar.gz files... – create a gzip-compressed archive
  • tar zxvf archive.tar.gz – decompress and extract archived files to current directory
  • gzip file.txt – compresses a file (creates file.txt.gz) and removes the original, uncompressed version
  • gunzip file.txt.gz – uncompresses a file that was compressed with gzip or compress and removes the compressed version
  • zip -r archive.zip files... – create a zip archive
  • unzip archive.zip [-d destination_folder] – extract/decompress zip achive
  • unzip -l archive.zip – list the contents of archive.zip
  • zcat, zless, zmore, zgrep, zdiff – these ‘Z’ commands operate on gzip-compressed files and provide a ‘Z’ equivalent to their regular counterparts
    • zcat system.log.0.gz – view a compressed file
      • zcat is identical to gunzip -c
    • zless system.log.0.gz – ‘Z’ equivalent of less to view a compressed file

Resources