7

Without doing stdout redirection. Is it possible to have a silent run of 7za?

1
  • Can you mark the correct answer?
    – ceztko
    Apr 2 '20 at 16:18
10

Yes that is possible.

Just add -y -bsp0 -bso0 to your command line. Those switches will disable progress, output reporting & assume yes answer to any possible questions, while still showing you any errors (which is perfect for cron usage).

Example:

7za a result.tar.7z -y -bsp0 -bso0 example.tar

From 7za --help:

-bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
-y : assume Yes on all queries

Tested to work on 7z version: 16.02.

Note, that version 9.20 bundled with some older OS (you can check your version by running 7za i) doesn't support that feature. You can download latest statically linked binaries at the official website.

5

Looking at the output of 7za --help, I don't think so.

Is there any particular reason why you don't want to just do 7za a archive.7z files > /dev/null?

2
  • Not quite the same as quiet if that's what @romant wanted.
    – pavium
    Jan 31 '10 at 10:24
  • 5
    @pavium True, but since there doesn't seem to be an option to run 7za in quiet mode, it looks like the best option available. Jan 31 '10 at 12:16
1

Side note: xz compressor uses the same algorithm 7Zip does (LZMA) but in a way similar to gzip or bzip2 making it compatible with standard UNIX tools.

You can compress a file:

$ xz file.ext
$ ls file*
file.ext.xz

Or use it to compress a directory with tar:

$ tar cJf dir.tar.xz dir/
$ ls -d dir*
dir   dir.tar.xz
0

Maybe you can wrap 7za in a script, so that the place that calls it doesn't need the redirection?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.