Piping hot ball of Tar.

For those who have gotten into the idea of typing commands as little as possible, here’s out to pipe the output from tar straight into a gzip file.

tar cvf - myfile.jpg | gzip > myfile.tar.gz
tar cvf - folder | gzip > folder_backup.tar.gz

Take note of the second example and notice how folder does not contain the trailing forward slash. The forward slash denotes everything inside the folder while leaving it off copies the entire folder itself into the archive. This way causes the extraction process recreate the folder while to former will only extract the files within the folder.