Dump the text on a virtual console to a file

If you're trying to fix a problem you might want to capture the output of a command for reproduction on a website forum, along with the command you typed to get the results. If you're working in a terminal window you can cut and paste, but what if you're working at a virtual

Eliminate the time period during which sudo/gksu powers hang around M 110

console? If you simply want to capture the result of a command, just redirect the output:

This will send both the output and error output (if any) of the ls command to output.txt. If you want to capture the command you typed, and any other command-line detritus (including output), use the screen-dump command. The following will send everything currently on the current screen (command-line prompts included) to a text file called output.txt:

$ sudo screendump > output.txt

The command has to be issued as root because of permission issues but the resulting file will be owned by you.

For more virtual console tricks and tips, see Tip 18, on page 76; Tip 179, on page 219; Tip 193, on page 232; Tip 198, on page 236; Tip 207, on page 241; and Tip 233, on page 276.

Was this article helpful?

0 0

Post a comment