Tar command in Linux
options:
-c: create the archive
-x: extract the archive
-f: create or extract with the specific archive filename
-t: displays or lists files in an archived file
-v: display info
-z: using gzip
-C: extract files into a specific directory, not the current directory
Creating an uncompressed tar archive.
1
tar -cvf file.tar directory
Creating a compressed tar archive by using gzip.
1
tar -cvzf file.tar.gz directory
Extracting files from archive.
1
tar -xvf file.tar
Extracting gzip tar archive.
1
tar -xvzf file.tar.gz
Extracting files into a specific directory.
1
tar -xvf file.tar -C /var/html/
Displays or lists files in the archived file.
1
tar -tvf file.tar