tarコマンド
スポンサードリンク
【説明】
アーカイブファイルを格納したり取り出したりする際に使用します。
アーカイブ・ファイルにファイルを格納したり抽出する為のアーカイブ・プログラムです。 tarfile はテープドライブ上に作成することも出来る。しかし、
tarfile を通常のファイルに書き込む事もよく行なわれている。 tar への最初の引数は、 オ プ シ ョ ンAcdrtux のいずれかでなくてはならない。この後にはどのオプション機能を指定する事も来る。
tar への最後の引数はアーカイブすべきファイル又はディレクトリ名である 。ディレクトリ名を指定した場合は常に、そのサブディレクトリもアーカイブに含められる
【構文】
tar [オプション] [ファイル/ディレクトリ] [ファイル/ディレクトリ]
例 TESTディレクトリ配下をtest.tarアーカイブファイルの中に格納し、test.tarアーカイブファイルの中を確認する。
[root@localhost test]# ls TEST/
test.patch test1 test2
[root@localhost test]# tar cvf test.tar TEST
TEST/
TEST/test1
TEST/test2
TEST/test.patch
[root@localhost test]#
[root@localhost test]# tar tf test.tar
TEST/
TEST/test1
TEST/test2
TEST/test.patch |
→lsコマンドの詳細を見る
例 test.tarアーカイブファイルをカレントディレクトリに展開する。
[root@localhost test]# ls
test.tar
[root@localhost test]#
[root@localhost test]#
[root@localhost test]# tar xvf test.tar
TEST/
TEST/test1
TEST/test2
TEST/test.patch
[root@localhost test]#
[root@localhost test]# ls
TEST test.tar |
|
|