試した環境
- WSL バージョン: 1.2.5.0
- Ubuntu 20.04.5 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
- GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
- UnZip 6.00
本題
unzip コマンドの -v オプションはzipファイルの情報を詳しく表示しますが、実際には展開しません。
$ ls -a . .. test.zip $ unzip -v test.zip Archive: test.zip Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 109 Stored 109 0% 2023-01-16 21:59 8ac69895 202301.txt 1121 Defl:N 693 38% 2023-02-25 15:53 3c9c170b 202302.txt 2771 Defl:N 1475 47% 2023-03-25 17:48 2b3550ab 202303.txt 6611 Defl:N 3357 49% 2023-04-30 17:03 c230ac77 202304.txt -------- ------- --- ------- 10612 5634 47% 4 files $ ls -a . .. test.zip
man unzip
やunzip -hh
コマンドで表示される -v オプションの説明を読みましたが、ファイルを展開しない旨がこの記述からは私は読み取れませんでした。
$ man unzip ... -v list archive files (verbose format) or show diagnostic version info. This option has evolved and now behaves as both an option and a modifier. As an option it has two purposes: when a zipfile is speci‐ fied with no other options, -v lists archive files verbosely, adding to the basic -l info the compres‐ sion method, compressed size, compression ratio and 32-bit CRC. In contrast to most of the competing utilities, unzip removes the 12 additional header bytes of encrypted entries from the compressed size numbers. Therefore, compressed size and compression ratio figures are independent of the entry's en‐ cryption status and show the correct compression performance. (The complete size of the encrypted com‐ pressed data stream for zipfile entries is reported by the more verbose zipinfo(1) reports, see the separate manual.) When no zipfile is specified (that is, the complete command is simply ``unzip -v''), a diagnostic screen is printed. In addition to the normal header with release date and version, unzip lists the home Info-ZIP ftp site and where to find a list of other ftp and non-ftp sites; the target operating system for which it was compiled, as well as (possibly) the hardware on which it was com‐ piled, the compiler and version used, and the compilation date; any special compilation options that might affect the program's operation (see also DECRYPTION below); and any options stored in environment variables that might do the same (see ENVIRONMENT OPTIONS below). As a modifier it works in conjunc‐ tion with other options (e.g., -t) to produce more verbose or debugging output; this is not yet fully implemented but will be in future releases. ... $ unzip -hh ... -v Use verbose list format. If given alone as unzip -v show version information. Also can be added to other list commands for more verbose output. ... -v List zipfile information in verbose, multi-page format. ...
-d オプションを加えると、-d オプションは無視され、ファイルを展開しない旨のメッセージが見られます。
$ unzip -vd . test.zip caution: not extracting; -d ignored Archive: test.zip Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 109 Stored 109 0% 2023-01-16 21:59 8ac69895 202301.txt 1121 Defl:N 693 38% 2023-02-25 15:53 3c9c170b 202302.txt 2771 Defl:N 1475 47% 2023-03-25 17:48 2b3550ab 202303.txt 6611 Defl:N 3357 49% 2023-04-30 17:03 c230ac77 202304.txt -------- ------- --- ------- 10612 5634 47% 4 files
参考
man unzip
unzip -hh