Useful Shell Commands for Data Practitioners

Working with Tar & Gzip Files

Untar and unzip a gzip file

tar -xzf filename.tar.gz

View contents of a tar.gz file

tar -ztvf filename.tar.gz

Extract specific files from tar.gz files

tar -xzf file.tar.gz "file_to_extract"

# this extracts a set of files with the given prefix 
tar -xzf file.tar.gz "*file_prefix*"

Create a tar.gz file

tar -czvf file.tar.gz directory