Redirect Unrar Error Messages to a Log File
This guide explains how to capture and redirect error messages
generated by the unrar command-line utility directly into a
dedicated log file. By utilizing standard stream redirection in Linux,
macOS, or Windows terminals, you can isolate extraction failures,
permission issues, and corrupted archive warnings without cluttering
your main terminal output.
Redirecting Standard Error (stderr)
Command-line programs output regular information through Standard
Output (stdout) and errors through Standard Error
(stderr). The unrar utility sends failure
notifications—such as invalid passwords, damaged blocks, or missing
volumes—to stderr.
To redirect only the errors to a text file while still viewing
standard extraction progress in the terminal, use the 2>
operator:
unrar x archive.rar 2> error.logIn this command:
xextracts files with their full path.archive.rarrepresents your target file.2>intercepts stream 2 (stderr) and writes it toerror.log. If the file already exists, it will be overwritten.
Appending Errors to an Existing Log
If you are running batch extraction scripts and want to preserve
previous error logs, append incoming errors instead of overwriting the
file by using the 2>> operator:
unrar x archive.rar 2>> error.logSilencing Normal Output and Logging Errors Only
To run an extraction silently in the background while recording only errors to the log file, redirect standard output to the null device:
Linux and macOS:
unrar x archive.rar > /dev/null 2> error.logWindows (Command Prompt):
unrar x archive.rar > NUL 2> error.logLogging All Output (Errors and Progress)
To capture both the extraction progress and any resulting error
messages in a single log file, redirect stderr into
stdout using 2>&1:
unrar x archive.rar > complete_output.log 2>&1