Q100481: How to redirect Nuke's command line output to a text file

Follow

SUMMARY

The following article explains how to redirect Nuke’s standard output and standard error output to text files:

 

MORE INFORMATION

Nuke’s command line operations are outputted as Standard Streams, which are split into Standard Input (STDIN), Standard Out (STDOUT) and Standard Error (STDERR).

Exporting Nuke’s command line output as a separate file allows the user to review these standard streams after the application has closed for custom plugin locations, rendering speed, or information outputted by the Script Editor.

By executing Nuke in a Command Prompt (Windows) or Terminal (macOS/Linux), you can redirect the command line output to a file using the ‘ > ’ symbolThis is used as a Redirection of Standard Streams to user-specified locations.

In order to redirect the STDOUT and STDERR streams, the command line operation needs to specify the File Descriptors of each stream, before the redirection symbol. The default file descriptor for the STDOUT stream is 1 and the STDERR stream is 2.

 

Redirecting to Separate Files:

The command line operation provided below shows an example of STDOUT and STDERR output redirection to different text files on the Desktop:

Windows:

"C:\Program Files\Nuke15.1v2\Nuke15.1.exe" -V 1> C:\Users\<USERNAME>\Desktop\stdout.txt 2> C:\Users\<USERNAME>\Desktop\stderr.txt

macOS:

/Applications/Nuke15.1v2/Nuke15.1v2.app/Contents/MacOS/Nuke15.1 -V 1> /Users/<USERNAME>/Desktop/stdout.txt 2> /Users/<USERNAME>/Desktop/stderr.txt

Linux:

/usr/local/Nuke15.1v2/Nuke15.1 -V 1> /home/<USERNAME>/Desktop/stdout.txt 2> /home/<USERNAME>/Desktop/stderr.txt

NOTE: Replace <USERNAME> with your machine user name.

There are a few things to highlight about the example commands provided above:

  • Redirecting the command line output will no longer display any information within the Command Prompt/Terminal, as all the data is being redirected to the text file.
  • Adding the -V verbose command line flag will include everything that Nuke loads by default and can be useful in diagnosing plugin issues.
    For more information on verbose mode, please refer to this article: Q100112: Launching Nuke in verbose mode and isolating potential customizations causing issues
  • You will need to add --nukex, --studio or --hiero to the command line examples above in order to launch NukeX, Nuke Studio, or Hiero as appropriate.

 

Redirecting to a Single File:

Both the standard output and standard error output can be redirected together to a single file by using the ‘&’ symbol. Merging both streams together provides the benefit of keeping all outputted data in the same file, and looks similar to the output typically displayed in the Command Prompt/Terminal window.

Below is an example command for each OS:

Windows:

"C:\Program Files\Nuke15.1v2\Nuke15.1.exe" -V > C:\Users\<USERNAME>\Desktop\stdall.txt 2>&1

macOS:

/Applications/Nuke15.1v2/Nuke15.1v2.app/Contents/MacOS/Nuke15.1 -V 1> /Users/<USERNAME>/Desktop/stdall.txt 2>&1

Linux:

/usr/local/Nuke15.1v2/Nuke15.1 -V 1> /home/<USERNAME>/Desktop/stdall.txt 2>&1

 

FURTHER READING

For more information on Nuke command line flags, please refer to our documentation: Command Line Operations

    We're sorry to hear that

    Please tell us why