I have picked up a few really useful tricks in the command line interface over the past year of programming but have a hard time remembering them all. I have been using the sidebar in MacOS as a reference to newly learnt ones (recently switching to the bear note taking app). However now I feel like I should make a note of all the ones I keep forgetting here in the hope I will remember them better.

Copy current working directory to clipboard

To use this the following into the CLI: alias cpwd="pwd | tr -d '\n' | pbcopy && echo 'pwd copied to clipboard'"

This came from Kyle Shevlin

Fuzzy finder useful commands

  • fzf find on github immensely helpful for navigating the command line interface.
  • Search current directory:
ctrl+t
  • Search previous CLI commands:
ctrl+r

Spending time moving around the line after a typo can be a pain. The following have saved me quite a bit of time:

  • Go to the start of the command prompt (if in bash this is where the $ sign is)
ctrl + a
  • Go to the end:
ctrl + e
  • Toggle between the start of the line and the current position:
ctrl + e