How to Disable Unrar Archive Comments
When extracting RAR archives using the command-line utility
unrar, embedded archive comments often print automatically
to the terminal, cluttering the output. This guide demonstrates how to
suppress these comments using the dedicated -c-
command-line switch and outlines alternative silent flags suited for
automated scripts and headless environments.
The -c- Switch
The standard method to prevent unrar from displaying
archive comments is the -c- switch. In the RAR command
syntax, appending a minus sign (-) to specific options
disables that behavior. By default, comment display is active
(-c+), so using -c- explicitly instructs the
utility to skip printing comment blocks to stdout.
Basic Usage
To extract an archive with full directory paths while hiding comments, run:
unrar x -c- archive.rarTo extract files into the current working directory without directory paths:
unrar e -c- archive.rarTo list the contents of an archive without printing comments:
unrar l -c- archive.rarSuppressing All
Terminal Output with -inul
If you are running unrar within a shell script or cron
job and want to suppress all standard output, including comments, file
names, and progress indicators, use the -inul (input/output
null) switch:
unrar x -inul archive.rarWhen -inul is supplied, unrar will produce
no standard terminal output. If an error occurs, you can still check the
shell exit status code ($?) to determine whether the
operation was successful.
Selective Suppression with
-id
Modern versions of unrar also provide the
-id switch, which allows you to selectively disable message
types:
-idc: Disables the copyright banner.-idp: Disables the percentage progress indicator.-idq: Turns on quiet mode, displaying only error messages.
You can combine these with the -c- flag to achieve
clean, readable logs:
unrar x -idc -c- archive.rar