2024年4月25日发(作者:)
linux tar 压缩 路径
在 Linux 中,使用 tar 命令可以实现文件或目录的压缩和解压缩。下面是一些
常用的 tar 压缩路径的示例:
1. 压缩单个文件:
`tar -czvf /path/to/file`
2. 压缩整个目录:
`tar -czvf /path/to/directory`
3. 压缩多个文件或目录:
`tar -czvf /path/to/file1 /path/to/file2
/path/to/directory`
或者可以使用通配符来压缩多个文件或目录:
`tar -czvf /path/to/files*`
4. 压缩多个文件或目录时排除特定文件或目录:
`tar -czvf exclude=file1 exclude=directory1
/path/to/file2 /path/to/directory2`
注意:上述命令中的 `-c` 表示创建新的压缩文件,`-z` 表示使用 gzip 压缩算
法,`-v` 表示显示详细信息,`-f` 表示指定压缩文件的名称。你可以根据实际情
况修改这些选项。
发布评论