tar is both a file format and the name of a program used to handle such files. Here a few examples.

# Make a backup of the /etc dir
tar cvfz /etc-backup.tgz /etc

# Extracting tar into chosen directory
tar xvzf filename.tar.gz -C /desired/path

# tar the directory cps100 (and its files/subdirectories) into a tar
# file named foo.tgz.
tar cvzf foo.tgz cps100

# To tar all .cc and .h files into a tar file named foo.tgz use:
tar cvzf foo.tgz *.cc *.h

# Create a tar named file.tar in the directory you currently are in.
# Wildcards could also be used in this command, for example: tar -cvwf
# file.tar *.txt would archive all txt files in the current directory.
tar cvwf file.tar myfile.txt

# Extracting (untar) an archive using tar command
tar xvf archive_name.tar

# Creating a tar gzipped archive using option cvzf
tar cvzf archive_name.tar.gz dirname/

# View the tar archive file content without extracting using option tvf
tar tvf archive_name.tar

# Extract a single file / directory from tarball archive
tar xvf /dev/st0 filename
tar xvf /dev/st0 directory-name
tar xvf mytar.ball.tar filename
tar -zxvf mytar.ball.tar.gz directory-name

# Extract file to /tmp directory
tar -zxvf mytar.ball.tar.gz -C /tmp filename
tar -zxvf mytar.ball.tar.gz -C /tmp dir-name

# Tar Extract a Single File(s) From a Large Tarball
# http://www.cyberciti.biz/faq/linux-unix-extracting-specific-files/

# Extract a file called `etc/default/sysstat` from `config.tar.gz` tarball
tar -ztvf config.tar.gz
tar -zxvf config.tar.gz etc/default/sysstat
tar -xvf {tarball.tar} {path/to/file}
# or
tar --extract --file={tarball.tar} {file}

# Extract a directory called `css` from `cbz.tar`
tar --extract --file=cbz.tar css

# Extract from cbz.tar all files beginning with `pic`, regardless of directory prefix
tar -xf cbz.tar --wildcards --no-anchored 'pic*'

# Extract all `php` files from `cbz.tar`
tar -xf cbz.tar --wildcards --no-anchored '*.php'

# UNIX decompress `tgz` / `tar.gz` file
gzip -dc filename.tgz | tar xf -
gzip -dc filename.tar.gz | tar xf -
# If file extension ends with `.Z`
zcat filename.tar.Z | tar xf -

# Copies directory_or_file_name on the local machine
# to /path/to/destination/directory_or_file_name on
# a remote machine.
tar -czf - directory_or_file_name | ssh username@hostname \
    "cd /path/to/destination; tar -xzf -"

# Copies the directory called directory_name from
# /path/to/source/directory_name on a remote server
# to the current directory on the local machine.
ssh username@hostname "cd /path/to/source; \
    tar -czf - directory_name" | tar -xzf -

# tar from file list
tar zcvf myFile.tar.gz file1.txt file2.txt file3.txt file4.txt