ubuntu echo in file code example
Example 1: echo to file permission denied
sudo bash -c 'echo "hello" > f.txt'
Example 2: echo to file permission denied
echo "hello" | sudo tee f.txt # add -a for append (>>)
sudo bash -c 'echo "hello" > f.txt'
echo "hello" | sudo tee f.txt # add -a for append (>>)