Unix command to prepend text to a file

One Two Three picture One Two Three · May 14, 2012 · Viewed 78.8k times · Source

Is there a Unix command to prepend some string data to a text file?

Something like:

prepend "to be prepended" text.txt

Answer

shime picture shime · Jan 14, 2015
printf '%s\n%s\n' "to be prepended" "$(cat text.txt)" >text.txt