Hitachi

JP1 Version 11 JP1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide 


8.4.16 gunzip command (decompresses compressed files)

Syntax

[Only for Windows]
gunzip [-c] [-f] [-k] [-l] [-N] [-n] [-q] [-r] [-t] [-v]
       [-o output-path-name] [-S suffix] [target-path-name ...]
[Only for UNIX]
gunzip [-a] [-c] [-f] [-k] [-l] [-N] [-n] [-q] [-r] [-t] [-v]
       [-o output-path-name] [-S suffix] [target-path-name ...]

Description

This command decompresses compressed files.

This command enables you to perform the following operations:

Operation type

Description

Decompress

Decompresses a compressed file (hereafter, this operation is called a decompression operation).

This operation is the same as the gzip command with the -d option specified.

If the -l and -t options are omitted, the decompression operation is performed.

In a decompression operation, the compressed file is deleted after the decompressed file is created. For how not to delete compressed files, see Description in 8.4.17 gzip command (compresses files or decompresses compressed files).

Display

Displays the information about the compressed file when the -l option is specified (hereafter, this operation is called a display operation). This operation is the same as the gzip command with the -l option specified.

Verify

Specifying the -t option verifies the integrity of the compressed data stored in the compressed file without decompressing the compressed file (hereafter, this operation is called a verification operation).

This operation is the same as the gzip command with the -t option specified.

For details about each operation, see Description in 8.4.17 gzip command (compresses files or decompresses compressed files).

You can use the options of the gunzip command without specifying them in the command arguments, by specifying the options in the environment variable GZIP. For details about the environment variable GZIP, see 2.5 Specifying environment variables.

Arguments

Specifying operation options

Specify the operation to be executed.

If this command is executed without specifying the following options, the compressed file will be decompressed (decompression operation):

-l

--list

Displays information about the compressed file (display operation).

Displays information such as the file size before compression and the compression ratio.

If the -v option is specified at the same time, detailed information about the compressed file is also displayed.

For details about the displayed content, see Displaying compressed file information in 8.4.17 gzip command (compresses files or decompresses compressed files).

Note that if the displayed file size before compression is 4 GB or greater, the value might not be displayed correctly. If you want to display the correct file size, specify the -t option at the same time. However, if the -t option is specified at the same time, displaying the file size might take some time.

-t

--test

Verifies the integrity of the compressed data stored in the compressed file without decompressing the compressed file (verification operation).

If this option is specified at the same time as the -l option, both the integrity verification of the compressed data and the display of information about the compressed file are performed.

Specifying the behavior for recovering file information

Specify the behavior for recovering file information.

If the -N and -n options are specified at the same time, only the last specified option is valid. If neither the -N nor -n option is specified, the -n option is valid. If the -N or -n option is specified at the same time as the -t option, the specification is ignored.

For details about using the most recent modification date and time in a decompression operation, see Handling of the most recent access date and time or the most recent modification date and time for a file in 8.4.17 gzip command (compresses files or decompresses compressed files). For details about the file name and using the most recent modification date and time in a display operation, see Displaying compressed file information in 8.4.17 gzip command (compresses files or decompresses compressed files).

-N

--name
[For decompression operations]

Names the file created at decompression using the file name stored in the compressed file. In addition, sets the most recent modification date and time stored in the compressed file, for the created file. If the file name and the most recent modification date and time are not stored in the compressed file, the system behaves the same as when the -n option is specified.

[For display operations]

In the displayed compressed file information, displays the file name and the most recent modification date and time stored in the compressed file.

-n

--no-name
[For decompression operations]

Names the file created at decompression using the file name from the compressed file, with the compressed file extension removed. In addition, sets the most recent modification date and time of the compressed file to the created file.

[For display operations]

In the displayed compressed file information, displays the file name as the compressed file name with its extension removed, and the most recent modification date and time of the compressed file.

Specifying input and output

-c

--stdout

--to-stdout
[For decompression operations]

Outputs the result of decompressing the compressed data to the standard output.

If this option is specified at the same time as the -l or -t option, the specification is ignored.

-k

--keep
[For decompression operations]

The compressed file is not deleted even after the decompressed file is created.

If this option is specified at the same time as the -l, -t, or -c option, the specification is ignored.

-r

--recursive

If the path specified in the target-path-name is a directory, searches for the compressed file in the directory and its subdirectories.

In Windows, when the -r option is specified, directory delimiters at the end of the path name are ignored, even when you specify a symbolic link to a directory.

The file extension determines whether files found while searching are handled as compressed files. For details about file extensions whose files are handled as compressed files, see Handling of the extensions of compressed files in 8.4.17 gzip command (compresses files or decompresses compressed files).

Symbolic links to directories are followed to their destination based on the operation type and the specified options. For details about behavior when a symbolic link to a directory is specified, see Handling of link files in 8.4.17 gzip command (compresses files or decompresses compressed files).

-ooutput-path-name

--output=output-path-name
[For decompression operations]

Creates the files to be decompressed based on the specified path name. In addition, in a decompression operation, the compressed file is deleted. If the -N option is specified at the same time as the decompression operation, the most recent modification date and time stored in the compressed file is used as the most recent modification date and time for the decompressed file that is to be created. The file name is based on the output-path-name.

This option ends in an error if one of the following is specified at the same time.

  • When the -c, -t, -l, or -r option is specified.

  • When more than one compressed file is specified.

  • When the compressed file is input from the standard input.

Target-path-name

Specify the path name for the compressed file.

For details about when files other than a compressed file are specified in target-path-name, see Handling of the extensions of compressed files in 8.4.17 gzip command (compresses files or decompresses compressed files).

More than one target-path-name can be specified.

If the target-path-name is not specified, or when - is specified to the target-path-name, enter the compressed data from the standard input. In a decompression operation, when the compressed data is input from the standard input, the result of decompressing the compressed data is output to the standard output. Note that in a decompression operation, an error occurs if the standard input is linked to the terminal.

The file types that can be specified for the target-path-name are as follows:

An error occurs if the specified target-path-name is a file type other than the file types that can be operated.

Other specifications

-a

--ascii
[Only for UNIX]

This option is for compatibility with the gunzip command provided by the OS.

This option is not valid even if specified. However, the message (gunzip: Option -a is ignored on this system) is output to the standard error output.

-f

--force

Permits the following operations:

[For decompression operations]

-S suffix

--suffix= suffix

Uses the specified suffix (any character string) as the extension of the compressed file.

[For decompression operations]

The system assumes that a file that has the extension .gz or .tgz, and has a suffix attached, is a compressed file.

The specifiable length of the suffix ranges from 1 to 30 bytes. Multibyte characters cannot be used for a suffix. For details about behavior when the suffix is specified, see Handling of the extensions of compressed files in 8.4.17 gzip command (compresses files or decompresses compressed files).

-q

--quiet

Suppresses message output.

However, the following messages are outside the scope of suppression:

  • Error messages for analyzing options

  • For decompression operations, messages that confirm whether you want to overwrite an existing file that has the same name as the decompressed file.

[For display operations]

Does not display the following information:

  • Header line

  • Total information of multiple compressed files

If the -v option is specified after this option, the specification for this option is canceled.

-v

--verbose

Displays the following information:

If the -q option is specified after this option, the specification for this option is canceled.

Return codes

Return code

Meaning

0

Normal termination

1

Error termination

In decompression operations, decompressed files are not created.

2

Error termination

In decompression operations, decompressed files are created. An error occurred at post-processing. For details about post-processing when an error occurs, see the output messages.

Note that when an operation is performed on multiple files and errors for both the return codes 1 and 2 occur, 1 is returned as the return code.

3

Error termination

An invalid option has been specified.

The return code is 1 when the following message is output:

Notes

For notes shared in common with the gzip command, see 8.4.17 gzip command (compresses files or decompresses compressed files). The following shows notes specific to the gunzip command:

Examples

The following shows an example of a decompression operation that uses the gunzip command. For decompression operations using the -l, -t, or other options, see the examples in 8.4.17 gzip command (compresses files or decompresses compressed files).