Tar and compress a directory in Linux

The following will tar and compress the contents of a directory

1
tar czf file.tar.gz input\_directory

The same can be extracted with tar but indicating compression .

1
tar xzvf file.tar.gz output_directory