「CentOS7入門」tarコマンドの使い方

1.tarで圧縮ファイルを作成
$ tar zcvf 作成するファイル名 対象ディレクトリ・ファイル
# tar zcvf testbak.tar.gz test/
test/
test/aa.php
test/aa.html
#ls

2.tarで圧縮ファイルを展開
$ tar zxvf 圧縮ファイル
# tar zxvf testbak.tar.gz
test/
test/aa.php
test/aa.html

 

3.圧縮ファイルの中身のファイル一覧を表示
$ tar tzf 圧縮ファイル
#tar tzf testbak.tar.gz
test/
test/aa.php
test/aa.html

4.特定のファイルのみ展開
$ tar zxvf 圧縮ファイル 対象ファイル
# tar zxvf testbak.tar.gz test/aa.php
test/aa.php

Linux

Posted by arkgame