You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu系统中7z命令参数失效问题求助

Why Your 7-Zip Command Fails & How to Fix It

Let's break down exactly what's going wrong here—your installed p7zip version (9.20.1) is a pretty old release (from 2011), and it doesn't support some of the newer parameters you're trying to use. Here's the play-by-play:

1. The -og Parameter Problem

In older 7-Zip versions like 9.20.1, the -o (output directory) switch requires you to specify the full path immediately after it—there's no standalone -og option. If you're trying to extract files to a directory named g, you need to write it as -og/ (for an absolute path) or -o./g (for a relative path to your current working directory). Critical note: there's no space between -o and the path.

2. The -bsp2 Parameter Problem

The -bsp2 switch is a newer addition to 7-Zip. In version 9.20.1, the -bsp switch alone enables progress output to standard output—there's no support for the numeric suffix (2) to adjust output behavior. If you need to redirect error streams, you'll have to use shell-level redirection instead of a 7-Zip parameter.

Fixed Command Examples

Extract to a g directory and show progress:

7z x my.zip -o./g -bsp

Redirect error output to standard output (simulating -bsp2 behavior):

7z x my.zip -o./g -bsp 2>&1

Bonus: Upgrade p7zip for Newer Features

Since Ubuntu Xenial's repositories only host the old 9.20.1 version, if you want access to all modern 7-Zip features (like -og and -bsp2), you could manually download a newer p7zip package from a trusted source or build it from source. That said, the fixed commands above will work perfectly with your current installation.

内容的提问来源于stack exchange,提问作者chapani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:19:45