Writing data to a file > echo "hello" > myfile.txt > Permission denied Simple enough, sudo to the rescue! > sudo echo "hello" > myfile.txt > Permission denied The sudo applies to the echo command, instead of the “>” operator The fix? Use tee - tee reads from STDIN and writes to the file and to STDOUT - but more importantly for our case, it lets us put the sudo
Simple, but useful shortcuts in a bash shell. Not a complete list, but I find myself using these the most: Editing CTRL + a: Beginning of line CTRL + e: End of line CTRL + w: Delete current word ALT + b: Backwards one word ALT + f: Forward one word CTRL + l: Clear screen See this post to alter your Terminal to use CTRL + Left Arrow or CTRL + Right Arrow for moving between words on a Mac.