redhat で tar 形式のアーカイブファイルを作成する ( 応用 )




redhat で tar 形式のアーカイブファイルを作成する際に
バックアップなどで毎度同じファイルをアーカイブする必要がある場合などは、
ファイル数が多くなると、毎回ファイルを指定するのは面倒な場合がある。

その場合は、あらかじめアーカイブ対象ファイルをファイルに記載しておいて、
tar コマンドではそのファイルを指定する。

実行例は次の通り。

まずはアーカイブ対象リストファイルを作成する。

# vi tar-list
test-file1
test-file2
test-file3
test-dir

アーカイブ対象リストを指定して tar コマンドを実行する。

# tar cvf test.tar -T tar-list
test-file1
test-file2
test-file3
test-dir/
test-dir/test-file4
test-dir/test-file5

redhat で tar コマンドを使う