0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

tar command Linux

Last updated at Posted at 2020-12-01

tar commandについて

複数のファイルを1つにまとめるアーカイブを実行するために使用されるコマンド。

○複数ファイルを1つにまとめる

tar -czvf (アーカイブ後のファイル名).tgz (まとめる対象ファイル)

xxxxxxx@MacBook-Pro tar-test-directory % ls
sample01.txt	sample02.txt	sample03.txt
xxxxxxx@MacBook-Pro tar-test-directory % tar -czvf archieve.tgz sample0
1.txt sample02.txt
a sample01.txt
a sample02.txt
xxxxxxx@MacBook-Pro tar-test-directory % ls
archieve.tgz		sample01.txt		sample03.txt
entire-compress.gz	sample02.txt

○まとめたファイルを展開する

tar -xzvf (展開するファイル名).tgz

xxxxxxx@MacBook-Pro tar-test-directory % ls
archieve.tar.gz	
xxxxxxx@MacBook-Pro tar-test-directory % tar xzvf archieve.tar.gz
sasakidaisuke@MacBook-Pro tar-test-directory % ls
Users		archieve.tar.gz	sample01.txt

Usersというディレクトリーが作成され、ここに解凍されたファイルが格納されている。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?