C Shell Wiki
Posts (Latest 10 updated) :
Read all
Contents:
  1. [Linux] C Shell (csh) gunzip Uso: Decompress gzip files
    1. Overview
    2. Usage
    3. Common Options
    4. Common Examples
    5. Tips

[Linux] C Shell (csh) gunzip Uso: Decompress gzip files

Overview

The gunzip command is used to decompress files that have been compressed using the gzip (GNU zip) compression algorithm. It restores the original file from its compressed format, making it accessible for use.

Usage

The basic syntax of the gunzip command is as follows:

gunzip [options] [arguments]

Common Options

  • -c: Write output to standard output; do not remove the original files.
  • -f: Force decompression, even if the file has multiple links or is not a valid gzip file.
  • -k: Keep the original compressed files after decompression.
  • -q: Suppress all warnings and error messages.
  • -v: Verbosely list the files processed.

Common Examples

Here are some practical examples of using the gunzip command:

  1. Decompress a single file:
    gunzip file.txt.gz
    
  2. Decompress multiple files at once:
    gunzip file1.gz file2.gz file3.gz
    
  3. Decompress a file and keep the original:
    gunzip -k file.txt.gz
    
  4. Output decompressed content to standard output:
    gunzip -c file.txt.gz > output.txt
    
  5. Force decompression of a file:
    gunzip -f file.txt.gz
    

Tips

  • Always check the integrity of the decompressed files, especially if they are critical for your work.
  • Use the -v option for verbose output to see the progress and details of the decompression process.
  • If you frequently work with compressed files, consider using zcat as an alternative to gunzip -c for viewing compressed file contents directly.