Ubuntu:Create archive tar
Appearance
Say you want to compress an entire directory named /home/vivek/data/, then type:
tar -czvf file.tar.gz /home/kangtain/data/
To compress multiple directories and files, execute:
tar -czvf file.tar.gz /home/kangtain/data/ /home/kangtain/pics/ /home/kangtain/.accounting.db
One can use bzip2 compression instead of gzip by passing the -j option to the tar command:
tar -cjvf file.tar.bz2 /home/vivek/data/
Where,
-c: Create a new archive-v: Verbose output-f file.tar.gz: Use archive file-z: Filter the archive through gzip-j: Filter the archive through bzip2