Skip to content

Terminal files

Reading files


  • cat + less + git + more


  • -Nshow line numbers
    • has syntax highlighting

Editing Files

Delete lines that match pattern

  • Delete lines that match
    • Used in [[work-aws]]
sed -i '' '/^\[localhost\]:56789/d' ~/.ssh/known_hosts;

How to append to a protected file (with sudo)

echo '' | sudo tee -a /etc/hosts
  • tee
    • read from standard input and write to standard output and files (or commands).

Listening to files


Run arbitrary commands when files change

Last update: 2023-04-24