7z
圧縮と転送
書き方
7z <a|x|l> <archive.7z> [files]最初に a(追加)・x(パスのまま展開)・e(平らに展開)・l(一覧)といった語を置いて使い、.7z だけでなく zip・tar・rar も読め、圧縮率も高いほうです。出力先は `-o` に空白を入れず続けて書き、名前まで隠すには `-p` に `-mhe=on` を添えます。
よく使うオプション
| オプション | 意味 |
|---|---|
| a | Add or create. |
| x | Extract keeping the stored directory structure. |
| e | Extract everything into one directory, flattening paths. |
| l | List the contents. |
| -o<dir> | Output directory, written with no space after -o. |
| -p<password> | Password. Add -mhe=on to encrypt the file names too. |
| -mx=9 | Maximum compression. |
| -t7z / -tzip | Choose the output format. |
例
7z a -mx=9 backup.7z ./dataA tightly compressed archive.
7z x archive.7z -o/tmp/outExtract with the folder structure intact.
7z a -p -mhe=on secret.7z ./docsEncrypt the contents and the file names, with a prompted password.
まとめることと縮めることは別の仕事です。tar がまとめ、gzip が縮め、.tar.gz はその両方です。
読み方
- 角括弧 [ ] は省いてよい部分です。
- 三点 … は複数並べられるという意味です。
- オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。
よくある質問
Q. 7z は何をしますか。
最初に a(追加)・x(パスのまま展開)・e(平らに展開)・l(一覧)といった語を置いて使い、.7z だけでなく zip・tar・rar も読め、圧縮率も高いほうです。出力先は `-o` に空白を入れず続けて書き、名前まで隠すには `-p` に `-mhe=on` を添えます。
Q. どう打ちますか。
7z <a|x|l> <archive.7z> [files] — 角括弧は省いてよい部分です。
Q. よく使うオプションはいくつですか。
ここにまとめたのは8個です。全部は man 7z にあります。このコマンドは圧縮と転送の仲間です。
関連するコマンド
man ページ: man 7z