「分かりそう」で「分からない」でも「分かった」気になれるIT用語辞典イメージぴよ画像「分かりそう」で「分からない」でも「分かった」気になれるIT用語辞典

zip【コマンド】

pointこの用語のポイント

pointコマンドだよ

pointUNIX系で使えるよ

pointzipファイルを作るよ

スポンサーリンク

簡単に書くよ

zip【コマンド】とは

コンピュータさんに対する命令文(コマンド)のひとつ
であり

ファイルをzip形式で圧縮するときに使うコマンド
です。


image piyo

詳しく書くよ

「zip」コマンド

ファイルを「zip」形式で圧縮するときに使うコマンド

です。
UNIXLinuxとかMacとか)で使えます。

書き方は

zip [オプション1] [zipファイル名] [ファイル名(複数可能)] [オプション2]

です。
オプションは、うんざりするくらいあります。

オプション説明
-aアスキーモードにするよ
-AAdjust self-extracting executable archive. A self-extracting executable archive is created by prepending the SFX stub to an existing archive. The -A option tells zip to adjust the entry offsets stored in the archive to take into account this "preamble" data.
-B[VM/CMS and MVS] force file to be read binary (default is text).
-B【数字】[TANDEM] set Edit/Enscribe formatting options with n defined as
bit 0: Don碪 add delimiter (Edit/Enscribe)
bit 1: Use LF rather than CR/LF as delimiter (Edit/Enscribe)
bit 2: Space fill record to maximum record length (Enscribe)
bit 3: Trim trailing space (Enscribe)
bit 8: Force 30K (Expand) large read for unstructured files
-b【パス】Use the specified path for the temporary zip archive.
-c元ファイルにコメントをつける
-dファイルをzipファイルの中から取り除く
-Dファイルのみを圧縮する。ディレクトリは含めない。
-eパスワード付きzipファイルにする
-E[OS/2] Use the .LONGNAME Extended Attribute (if found) as filename.
-f指定されたファイルがzipファイル内にすでに存在する場合、新しければ置き換える
-Fzipファイルを修復してみる
-g既存のzipファイルに追加する
-hヘルプを表示する
-i 【ファイル名】指定ファイルのみを格納する
-jファイル名のみ追加するパスディレクトリ名は記録しない)
-JStrip any prepended data (e.g. a SFX stub) from the archive.
-l改行コードLFからCR+LFに変換する
-ll改行コードをCR+LFからLFに変換する
-Lzipコマンドのライセンスを表示する
-mzipファイルに追加したとき、元ファイルは削除する
-n 【拡張子】指定拡張子のファイルは圧縮しないで格納する
-ozipファイルの更新日時を元ファイルの最新のファイル更新時刻に合わせる
-P 【パスワード】パスワード付きzipファイルにする
-q処理中のメッセージを表示しない
-r指定ディレクトリ配下のファイル、ディレクトリを再帰的に格納する
-Rカレントディレクトリ配下のファイル、ディレクトリを再帰的に格納する
-t 【日付mmddyyyy】指定された日付以降のファイルを対象とする
-tt 【日付mmddyyyy】指定された日付以前のファイルを対象とする
-T作ったzipファイルの整合性をチェックする?
-u新規作成 or 更新されたファイルのみ追加する
-v処理結果をじっくりはっきり詳細に出力する
-V[VMS] Save VMS file attributes and use portable form. zip archives created with this option are truncated at EOF but still may not be usable on other systems depending on the file types being zipped.
-VV[VMS] Save VMS file attributes and use portable form. zip archives created with this option are truncated at EOF but still may not be usable on other systems depending on the file types being zipped.
-w[VMS] Append the version number of the files to the name, including multiple versions of files. (default: use only the most recent version of a specified file).
-x 【ファイル名】Explicitly exclude the specified files, as in: zip -r foo foo -x \*.o which will include the contents of foo in foo.zip while excluding all the files that end in .o. The backslash avoids the shell filename substitution, so that the name matching is performed by zip at all directory levels. If you do not escape wildcards in patterns it may seem to work but files in subdirectories will not be checked for matches. Also possible: zip -r foo foo -x@exclude.lst which will include the contents of foo in foo.zip while excluding all the files that match the patterns in the file exclude.lst (each file pattern on a separate line).
-XDo not save extra file attributes (Extended Attributes on OS/2, uid/gid and file times on Unix).
-y対象がシンボリックリンクの場合、リンク先のファイルではなくシンボリックリンク自体を追加する
-zPrompt for a multi-line comment for the entire zip archive.
-【数字】圧縮速度を指定する。「-0」は圧縮しない。「-1」は圧縮率よりも処理速度優先。「-9」は処理速度よりも圧縮率を優先
-@圧縮対象のファイル名を対話形式で入力する

などです。

単純に圧縮したい場合は

zip [zipファイル名] [元ファイル名(複数可能)]

でOKです。
例えば

zip a.zip a.txt b.txt

のように打つと「a.txt」と「b.txt」をまとめて圧縮して「a.zip」を作ってくれます。
あとは必要に応じてオプションを指定すれば良いと思います。


image piyo2

一言でまとめるよ

まぁ「zip」ってコマンドが出てきたら「zipファイルを作るときに使うんだな~」と お考えください。

一番上に戻るよ
スポンサーリンク
書籍画像077
書籍画像076

おまけ

■検索してみる?




書籍画像
わわわ説明術コラム
宣伝だよ
「分かった!」と思わせる説明の技術 知識ゼロの相手にも伝わるようになる本
「定年力」の鍛え方 老後の毎日を最高にする方法
「技術書」の読書術 達人が教える選び方・読み方・情報発信&共有のコツとテクニック