1.tar方式:
tar压缩: tar -zcvf /home/test.tar.gz /test tar -cvf /home/test.tar.gz /test tar -zcvf 打包后生成的文件名全路径 要打包的目录 例子:把/test文件夹打包后生成一个/home/test.tar.gz的文件。 tar解压到指定目录: tar -zxvf test.tar.gz -C ./src
2.zip方式:
zip压缩: zip -q -r test.zip /home/test zip解压: unzip test.zip
复制文件夹
复制文件夹:
cp -Rf /home/test/* /root/temp/
将 /home/test目录下的所有东西拷到/root/temp/下而不拷贝test目录本身。
即格式为:cp -Rf 原路径/ 目的路径/
不覆盖原文件:
将文件夹test下的所有文件及子目录复制到New目录下,存在相同文件不覆盖
awk 'BEGIN { cmd="cp -ri ./test/* ./New "; print "n" |cmd; }'



