Avb Avb
Avb Avb

Reputation: 553

Linux writing console output to a file

I have a large amount of prints on the console and I want to store them into a file. Can anyone suggest a way in Linux?

Upvotes: 2

Views: 3065

Answers (2)

GMaster
GMaster

Reputation: 1521

To make sure you get both stderr and stdout to the file instead of the console

command_generating_text &> /path/to/file

To keep stderr and stdout to different files

command_generating_text 1> /path/to/file.stdout 2> /path/to/file.stderr

Upvotes: 0

doniyor
doniyor

Reputation: 37846

your_print_command > filename.txt

Or

your_print_command >> filename.txt 

The latter appends data into file instead of overriding it.

Upvotes: 2

Related Questions