Linux常用命令09tar压缩解压文件

1、压缩文件

#只归档不压缩
tar –cf OUT_FILE_NAME.tar PATH_TO_FOLDER
#归档后用gzip压缩
tar –czf OUT_FILE_NAME.tar.gz PATH_TO_FOLDER
#归档后用bzip2压缩
tar –cjf OUT_FILE_NAME.tar.bz2 PATH_TO_FOLDER
#归档后用compress压缩
tar –cZf OUT_FILE_NAME.tar.Z PATH_TO_FOLDER

2、解压文件

#解压tar
tar –xvf IN_FILE_NAME.tar
#解压tar.gz
tar -xzvf IN_FILE_NAME.tar.gz
#解压tar.bz2
tar -xjvf IN_FILE_NAME.tar.bz2
#解压tar.Z
tar -xZvf IN_FILE_NAME.tar.Z

Leave a Reply

Your email address will not be published. Required fields are marked *

*