This one ended up being a lot of rabbit holes also.

Source

grep

  • “Global Regular Expression Print”

stuff I didn’t know:

  • grep -n: show line numbers on output
  • grep {-A,-B} #: show # of lines as context after/before matching line

Misc tips and tricks

  • ls -l | tail -n +2 | cut -f3-: start with second line of output, cut from field 3 onwards
  • tac: reverses a file (opposite of cat)

Copy paste in tmux

actually copy pasting with nested tmux windows in WSL terminal:

  • line selection: hold shift (does not work with multiple windows)
  • rectangle selection: hold alt+shift
  • deselect: esc

Note

After doing all this looking into nested tmux, I just bound my WSL tmux leader key to <C-a> to stop conflict with remote tmux server’s leader of <C-s>

fail2ban manually ban an IP

sudo fail2ban set sshd banip XXX.XXX.XXX.XXX`

Couple of git tips

# undo most recent commit (only works BEFORE you have pushed to remote)
git reset HEAD~1
 
# pull remote repo and resolve conflicts
git pull --rebase

Maybe this diagram will be helpful in the future…but not quite there yet:

EOF