How do i obtain information about a zip file on linux?



  • The command is associated with files that are compressed using the zip command.

    Man page for: zip
    Man page for: unzip
    Man page for: zipinfo

    The command has three options which do basically the same
    -s short, -m medium, and -l long formats

    The information is on compression, compression type, datestamps, and permissions, the entire archive can be listed or individual files in the archive.

    The entire archive listing with pager. The -M option is the pager option.

    $ zipinfo -M chef-starter.zip
    Archive:  chef-starter.zip
    Zip file size: 7825 bytes, number of entries: 21
    drwxr-xr-x  5.2 unx        0 t- defN 18-Mar-21 19:20 chef-repo/cookbooks/
    -rw-r--r--  5.2 unx      588 t- defN 18-Mar-21 19:20 chef-repo/cookbooks/chefignore
    ...
    ...
    ...
    21 files, 7976 bytes uncompressed, 4805 bytes compressed:  39.8%
    

    You will notice in the above output that there is no individual file compression percentages. This is where -m and -l provide this, but with a slight difference. The -m provides the compression in percentage and -l provides it as a numerical value.

    The -m output.

    $ zipinfo -Mm chef-starter.zip
    Archive:  chef-starter.zip
    Zip file size: 7825 bytes, number of entries: 21
    drwxr-xr-x  5.2 unx        0 t-  0% defN 18-Mar-21 19:20 chef-repo/cookbooks/
    -rw-r--r--  5.2 unx      588 t- 35% defN 18-Mar-21 19:20 chef-repo/cookbooks/chefignore
    ...
    ...
    ...
    

    The -l output.

    $ zipinfo -Ml chef-starter.zip
    Archive:  chef-starter.zip
    Zip file size: 7825 bytes, number of entries: 21
    drwxr-xr-x  5.2 unx        0 t-        2 defN 18-Mar-21 19:20 chef-repo/cookbooks/
    -rw-r--r--  5.2 unx      588 t-      382 defN 18-Mar-21 19:20 chef-repo/cookbooks/chefignore
    ...
    ...
    ...
    

    List just one file in the archive. Just specify the file as listed when using the entire listing.

    $ zipinfo -Mm chef-starter.zip chef-repo/.gitignore
    -rw-r--r--  5.2 unx      495 t- 33% defN 18-Mar-21 19:20 chef-repo/.gitignore
    

    The output listing the following:

    Output from listing Description
    -rw-r-r- unix permissions
    5.2 version of zip that was used.
    unx unix format
    495 before compression size
    t text file
    - any non standard information in the archive (see man page)
    33% the percentage the file was compressed
    defN the type of compression

    followed by date, time, and file name.


Log in to reply
 

© Lightnetics 2024