
=> Create the archive
=> Compress the archive
You need to use tar command as follows (syntax of tar command):
$ tar -zcvf archive-name.tar.gz directory-name
Where,
- -z: Compress archive using gzip program
- -c: Create archive
- -v: Verbose i.e display progress while creating archive
- -f: Archive File name
$ tar -zcvf lab-1-jan-2014.tar.gz /home/jonny/lab
Above command will create an archive file called lab-1-jan-202014.tar.gz in current directory. If you wish to restore your archive then you need to use following command (it will extract all files in current directory):
$ tar -zxvf lab-1-jan-2014.tar.gz
Where,
- -x: Extract files
$ tar -zxvf lab-1-jan-2014.tar.gz -C /tmp
$ cd /tmp
$ ls
+BASH Shell Scripting Q&A +FreeBSD +Linux +The Linux Foundation
No comments:
Post a Comment