糖尿病康复,内容丰富有趣,生活中的好帮手!
糖尿病康复 > Linux下tar解压到当前目录 zip压缩 tar压缩 tar解压

Linux下tar解压到当前目录 zip压缩 tar压缩 tar解压

时间:2024-03-19 09:36:26

相关推荐

Linux下tar解压到当前目录 zip压缩 tar压缩 tar解压

Linux下tar解压tar.gz文件到当前目录

很多时候我们需要把文件解压到当前目录,命令如下:

tar -zxvf vscode-server-linux-x64.tar.gz -C ./

有时候很讨厌,因为tar.gz的包里就存在一个与压缩包同名的目录,这种情况的话需要先解压,再拷贝:

tar -zxvf vscode-server-linux-x64.tar.gz -C ./mv vscode-server-linux-x64/* .

zip压缩的方法:How do I zip/unzip on the unix command line? - Unix & Linux Stack Exchange

zip squash.zip file1 file2 file3# or to zip a directoryzip -r squash.zip directory

tar压缩:

tar -zcvf myfile.tgz file1 file2

tar解压:

tar -zxvf myfile.tgztar -xvzf community_images.tar.gztar jxxf filename.tar.bz2

f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.

z: tells tar to decompress the archive using gzip

x: tar can collect files or extract them. x does the latter.

v: makes tar talk a lot. Verbose output shows you all the files being extracted.

tar -zxvf filename.tar.gz

其中zxvf含义分别如下

z: gzip 压缩格式

x: extract 解压

v: verbose详细信息

f: file(file=archieve)文件

tar -jxvf filename.tar.bz2tar -Jxvf filename.tar.xztar -Zxvf filename.tar.Z

事实上, 从1.15版本开始tar就可以自动识别压缩的格式,故不需人为区分压缩格式就能正确解压

tar -xvf filename.tar.gztar -xvf filename.tar.bz2tar -xvf filename.tar.xztar -xvf filename.tar.Z

有个使用jar进行解压的奇淫技巧:

jar -xf file.zip

如果觉得《Linux下tar解压到当前目录 zip压缩 tar压缩 tar解压》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。