Skip to content

Terminal files

Reading files

bat

  • cat + less + git + more

less

  • -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 '127.0.0.1 redirected-url.com' | sudo tee -a /etc/hosts
  • tee
    • read from standard input and write to standard output and files (or commands).

Listening to files

Entr

Run arbitrary commands when files change


Last update: 2022-09-23