Unix command to prepend text to a file

command lineprependunixUtilities

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

Something like:

prepend "to be prepended" text.txt

Best Answer

printf '%s\n%s\n' "to be prepended" "$(cat text.txt)" >text.txt