How to zip multiple files into one zip file.
Using zip.
zip test.zip *.txt |
Using tar.
tar cvzf test.tar.gz *.txt |
Untar in current directory or specify another directory.
tar xvzf test.tar.gz . tar xvzf test.tar.gz -C /path/to/dir |
cloud engineer
How to zip multiple files into one zip file.
Using zip.
zip test.zip *.txt |
zip test.zip *.txt
Using tar.
tar cvzf test.tar.gz *.txt |
tar cvzf test.tar.gz *.txt
Untar in current directory or specify another directory.
tar xvzf test.tar.gz . tar xvzf test.tar.gz -C /path/to/dir |
tar xvzf test.tar.gz . tar xvzf test.tar.gz -C /path/to/dir
Here are two important tar commands on how to create and extract a tar.gz file.
Create a tar gzip file called “project.tar.gz” of a directory called “foo.”
tar -cvzf project.tar.gz foo |
tar -cvzf project.tar.gz foo
Untar the “project.tar.gz” file to a directory called bar.
tar -xvzf project.tar.gz bar |
tar -xvzf project.tar.gz bar