linux script file tutorial add line at first in the end and a specific line code example Example: add line to beginning of file shell script $ sed -i '1s/^/added text /' file