• Skip to main content

Uly.me

cloud engineer

  • Home
  • Archives
  • Search

gzip

zip multiple files into one zip

December 31, 2021 by Ulysses

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

Filed Under: Linux Tagged With: directory, files, gzip, multiple, tar, zip

Tar Commands

October 30, 2019 by Ulysses

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

Filed Under: Linux Tagged With: create, directory, gzip, tar, untar

  • Home
  • About
  • Contact

Copyright © 2022