GNU/Linux >> Linux の 問題 >  >> Linux

zip:コマンドが見つかりません

Microsoft Windows の世界で仕事をしたことがあるなら、間違いなく zip ファイルを使用したことがあります。これは非常に人気のある機能となり、Microsoft は最終的に XP 以降の Windows オペレーティング システムに組み込みました。 zip ユーティリティを使用すると、大きなファイル (テキストと実行可能ファイルの両方) を、スペースをとらない小さなファイルに簡単に圧縮できます。

zip コマンドで使用可能なオプションを表示するには、次のコマンドを実行します:

% zip --help
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
  The default action is to add or replace zipfile entries from list, which
  can include the special name - to compress standard input.
  If zipfile and list are omitted, zip compresses stdin to stdout.
  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -y   store symbolic links as the link instead of the referenced file
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help

zip コマンドの実行中に以下のエラーが発生した場合:

zip: command not found

選択したディストリビューションに従って、以下に示すように zip パッケージをインストールしてみてください。

分布 コマンド
OS X brew インストール zip
Debian apt-get インストール zip
Ubuntu apt-get インストール zip
アルパイン apk add zip
Arch Linux pacman -S zip
カリ Linux apt-get インストール zip
CentOS yum インストール zip
Fedora dnf インストール zip
Raspbian apt-get インストール zip

zip コマンドの例

1. 他のディレクトリを含むディレクトリを圧縮しようとすると、現在使用しているコマンドはそれらのディレクトリをスキップします。 -r オプションを使用して、これらのフォルダーに再帰的に移動するように zip に指示する必要があります。

$ zip -r test.zip /tmp/test/*

2. ファイル/ディレクトリを特定のアーカイブに追加します:

$ zip -r path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...

3. 特定のアーカイブからファイル/ディレクトリを削除します:

$ zip -d path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...

4. 指定されたものを含む[x]ファイル/ディレクトリのアーカイブ:

$ zip path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ... -x path/to/excluded_files_or_directories

5. 特定の圧縮レベル (`0` – 最低、`9` – 最高) でファイル/ディレクトリをアーカイブします:

$ zip -r -0-9 path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...

6. 特定のパスワードで [e] 暗号化されたアーカイブを作成します:

$ zip -r -e path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...

7. ファイル/ディレクトリをマルチパート [s]plit zip ファイルにアーカイブします (例:3 GB のパート):

$ zip -r -s 3g path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...

8. 特定のアーカイブ コンテンツを印刷する:

$ zip -sf path/to/compressed.zip
unzip:コマンドが見つかりません


Linux
  1. ifrename:コマンドが見つかりません

  2. dpkg:コマンドが見つかりません

  3. netstat:コマンドが見つかりません

  1. kubectl:コマンドが見つかりません

  2. tvservice:コマンドが見つかりません

  3. lspci:コマンドが見つかりません

  1. pstree:コマンドが見つかりません

  2. id:コマンドが見つかりません

  3. w:コマンドが見つかりません