- The tar command is used to package files for compression or decompression
- Format: tar [option-c specifies the directory to extract] [file]
- To package and compress files:
TAR-ZCVF compressed package name. tar.gz file name
- Unzip and expand the ZIP package
TAR-ZXVF compressed package name. tar.gz
[[email protected] testb]# ls111. txt222. txt
Save the file name by using gzip package for 111.txt file 111.tar.gz [Email protected] testb]# tar zcvf111. tar.gz111. txt111. Txt[[email protected] testb]# ls111. tar.gz111. txt222. Txt[[email protected] testb]# RM-rf111. Txt[[email protected] testb]# ls111. tar.gz222. txt
Unzip 111.tar.gz to current directory
[Email protected] testb]# tar zxvf111. tar.gz111. Txt[[email protected] testb]# ls111. tar.gz111. txt222. txt
unzip the 111.tar.gz to the specified directory/ROOT/TESTC [Email protected] testb]# tar-zxvf111. tar.gz-c/root/testc/111. Txt[[email protected] testb]# ll/root/testc/Total Dosage4-rw-r--r--.1Root root3September7 the: at 111. txt
Linux command-tar