To make a compressed tar ball of the current directory
tar -cvz -f path_to_the_archive_to_be_created .
Example:
[user@machine temp]$ tar -cvz -f ~/dir1/temp.tar.gz .
The current directory (temp) is archived into ~/dir1/temp.tar.gz
To make a compressed tar ball of a remote directory
tar -cvz -f path_to_the_archive_to_be_created -C path_to_the_remote_directory .
Example:
[user@machine ~]$ tar -cvz -f ~/dir1/temp.tar.gz -C ~/temp .
The directory ~/temp is archived into ~/dir1/temp.tar.gz
.
-c, --create create a new archive
-v, --verbose verbosely list files processed
-z, --gzip, --gunzip, --ungzip filter the archive through gzip
-f, --file=ARCHIVE use archive file or device ARCHIVE
-C, --directory=DIR change to directory DIR