Nov 10, 2018

How to add text to the beginning of a file from command line in Linux

sed -i '1iContent you want to add to the beginning of the file' your-file.txt
or
sed -i '1s/^/Content you want to add to the beginning of the file\n/' your-file.txt