Linux 解凍する前にzipファイルの中身を確認する

Linux 解凍する前にzipファイルの中身を確認する

Linuxで、解凍する前にzipファイルの中身を確認する手順を記述してます。

環境

  • OS Rocky Linux release 8.4 (Green Obsidian)
  • shell: /bin/bash

解凍する前にzipファイルの中身を確認

解凍する前にzipファイルの中身を確認するには、「 unzip 」コマンドの「-Z」を使用します。

実際に、「arc.zip」というzipファイルの中身を確認してみます。

unzip -Z arc.zip

<出力結果>
Archive:  arc.zip
Zip file size: 498 bytes, number of entries: 3
drwxrwxr-x  3.0 unx        0 bx stor 21-Sep-10 10:58 foo/
-rw-rw-r--  3.0 unx        0 BX stor 21-Sep-10 12:36 foo.txt
-rw-rw-r--  3.0 unx        0 BX stor 21-Sep-10 12:36 foo.log
3 files, 0 bytes uncompressed, 0 bytes compressed:  0.0%

「 less 」コマンドでも、確認可能です。

less arc.zip

<出力結果>
Archive:  arc.zip
Zip file size: 498 bytes, number of entries: 3
drwxrwxr-x  3.0 unx        0 bx stor 21-Sep-10 10:58 foo/
-rw-rw-r--  3.0 unx        0 BX stor 21-Sep-10 12:36 foo.txt
-rw-rw-r--  3.0 unx        0 BX stor 21-Sep-10 12:36 foo.log
3 files, 0 bytes uncompressed, 0 bytes compressed:  0.0%

「 zipinfo 」コマンドでも、確認可能です。

zipinfo arc.zip

<出力結果>
Archive:  arc.zip
Zip file size: 442 bytes, number of entries: 3
-rw-rw-r--  3.0 unx        0 bx stor 21-Sep-16 14:54 foo.txt
-rw-rw-r--  3.0 unx        0 bx stor 21-Sep-16 14:55 foo.log
drwxrwxr-x  3.0 unx        0 bx stor 21-Sep-16 14:55 foo/
3 files, 0 bytes uncompressed, 0 bytes compressed:  0.0%