To extract a tar file, run
tar xf file.tar.gz
Uncompress tar.gz file
tar -zxvf ncftp-3.2.2-src.tar.gz
Uncompress tar.bz2 file
tar -jxvf ncftp-3.2.2-src.tar.bz2
Create a tar file
tar -cvf file.tar FOLDER_OR_FILE_NAME
Example
tar -cvf backup.tar public_html
Once backup.tar file is created, you can make it tar.gz with command
gzip backup.tar
Exclude a folder from tar file
To exclude a folder, you can use –exclude option.
tar cvf backup.tar --exclude=public_html/uploads --exclude=public_html/wordpress public_html
List content of a tar file
tar --list --verbose --file=BACKUP.tar.gz
If you want to exclude a folder from the file list, use
tar --list --verbose --file=BACKUP.tar.gz --exclude=home/haridy/Maildir
This will exclude all files that are inside folder “home/haridy/Maildir”. You can use multiple –exclude if required.
Using tar over SSH Session
Split Large file into smaller files
How to view the contents of tar.gz file
Leave a Reply