linux

*.tar.gz

unzip

tar -xvzf foo.tar.gz
  • f: specify file name
  • z: use gzip
  • x: extract
  • v: verbose

to specify output directory (unless it uses current dir):

tar -xvzf foo.tar.gz -C output_dir

zip

  • c: create a new archive
tar -zcvf archive_name.tar.gz directory_to_compress