FetchLinux文件解压指南
核心说明 FetchLinux 主要用于从网络获取文件,本身不提供压缩/解压功能。解压应在其终端里使用常见的 Linux 命令行工具(如 tar、unzip、gunzip、bunzip2、xz、7z)完成,这些工具在 FetchLinux 环境中均可直接使用。
常用解压命令一览
tar -xvf 文件名.tartar -xvzf 文件名.tar.gztar -xvjf 文件名.tar.bz2tar -xvJf 文件名.tar.xzunzip 文件名.zip -d 目标目录gunzip 文件名.gzbunzip2 文件名.bz2xz -d 文件名.xz7z x 文件名.7z
说明:选项含义常用为 -x 提取、-v 显示过程、-f 指定文件、-z gzip、-j bzip2、-J xz;目标目录参数 -d 可指定解压路径。结合FetchLinux下载后直接解压
wget -O archive.tar.gz https://example.com/file.tar.gz && tar -xvzf archive.tar.gzcurl -L -o archive.zip https://example.com/file.zip && unzip archive.zip -d ./extracted
说明:FetchLinux 支持 wget、curl 等下载工具,可与解压命令通过 && 串联,实现“一键下载并解压”。批量解压与后台运行
for z in *.zip; do unzip -n "$z" -d "${z%.zip}"; donels *.zip | parallel -j 8 unzip -n -d extracted {}nohup unzip -n '*.zip' -d extracted >& unzip.log &
提示:选项 -n 表示不覆盖已存在文件;nohup ... & 可使任务在关闭终端后继续运行,日志写入 unzip.log 便于排查。常见问题与处理
sudo apt-get update && sudo apt-get install unzip p7zip-full;RHEL/CentOS 系可用 sudo yum install unzip p7zip(安装后再执行对应解压命令)。gunzip / bunzip2 / xz -d 会生成去除后缀的原始文件;对归档格式(如 .tar.gz)应使用 tar 进行提取。tar -xvf 文件.tar -C 目标目录,或 unzip 文件.zip -d 目标目录;解压前可用 ls 目标目录 确认路径是否正确。