Logging and redirecting

Logging commands | Redirecting output | Capturing listable output

Logging commands

Use the HSI log command to write commands and responses such as error messages to a local log file during an HSI session.

Start the session by entering hsi on your command line.

Then, to create the log file and begin logging, enter log and the name of the file.

[HSI] log filename
Log output now being written to `filename'

Subsequent commands will be written to the file in your local directory.

To append log output to an existing file, follow this example.

[HSI] log >> filename
Log output now being written to `filename'

To stop logging during the session, enter log with a minus sign.

[HSI] log -

Redirecting output

To redirect output from an HSI command to a file in your local directory, invoke hsi and the desired command from your command line using -P and as shown here.

hsi -P hsi_command > output_file

To append the output to an existing file, use -P and >> as follows.

hsi -P hsi_command >> output_file

Capturing listable output

In these examples, output_file is a local file to which all listable output (both stdout and stderr) will be written.

Start an HSI session by entering hsi on your command line.

Use the out command to create the local file or overwrite an existing file with the same name by following this example.

[HSI] out output_file
Listing output now being written to `output_file'

Use this syntax to append output to the file or create a file if it doesn't exist.

[HSI] out >> output_file
Listing output now being written to `output_file'

 

Related training courses