Write to a file >
, >>
Append content at the beginning of the file.
echo whatever > hello.txt
echo Hello world >> hello.txt
cat hello.txt
# whatever
# Hello world
(echo at the beginning; cat hello.txt) > hello.txt_ && mv hello.txt{_,}
cat hello.txt
# at the beginning
# whatever
# Hello world
read from a file <
# count how many words in hello.txt
wc -c < hello.txt