Append Output To File

We can append the outputs of a program to a file by using the >> operator.

Run date To See Standard Output

Note +"%T.%N" gives the current time with nanseconds

date +"%T.%N"
21:19:26.291589981

Create File

touch records.txt

Append The Standard Output To File

Note that we run date +%s%N four times, each time appending the results to records.txt.

date +"%T.%N" >> records.txt; date +"%T.%N" >> records.txt; date +"%T.%N" >> records.txt; date +"%T.%N"  >> records.txt

View File’s Contents To See Redirected Standard Output

cat records.txt
21:21:50.875588383
21:21:50.876275526
21:21:50.876939495
21:21:50.877571864