delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

Is it "ls > log.txt"?
Kind regards,
Kepler


If I have a command line like "ls" how can I save the results to a log.txt file, for example?
Is it "ls > log.txt"?
Kind regards,
Kepler

TOP

yes.
Or to append (add to the end)
ls >> logfile
remember, don't be afraid to experiment. Although don't do it as root

TOP

If you want to save errors then redirect stderr (file number 2 - stdin is 0 and stdout is 1):
Code:
  1. command > /dir/normaloutput.txt 2> /dir/erroroutput.txt
Copy Code
If you want to combine the two:
Code:
  1. command > /dir/alloutput.txt 2>&1
Copy Code
As LinuxPenguin says, change > to >> to concatenate the output.

TOP

Thanks.
Kepler



Is it "ls > log.txt"?
Kind regards,
Kepler

TOP

Back Forum