Saturday, April 24, 2010

File backups with tar

Creating an Archive File

tar -czf scripts.tgz scripts/ scripts-test/

List the Contents

tar -tzf scripts.tgz
find a file in archive:
tar -tzf scripts.tgz | grep file.txt

Extracting an Archive File

Now that you know how to create an archive file, it’s rather easy to extract it.
tar -xzf scripts.tgz
You might need extract just one file:
tar -xzf scripts.tgz scripts/readme.txt

No comments :

Post a Comment