Terminal Quick Tips for Mac

A cheatsheet full of terminal commands, from basic to bombastic and frequently updated.

  1. Open present path in finder

    • $ open .
  2. Paste finder path in terminal

    • Drag the folder and drop it in terminal.
    • Alfred can copy the path to clipboard.
  3. Display present terminal path

    • $ pwd
  4. Create Folder

    • $ mkdir foldername
  5. Create File

    • $ touch filename
  6. Delete Folder and everything it contains

    • $ rm -rf /insert/path/here
  7. Delete empty folder

    • $ rmdir /insert/path/here
  8. Delete file

    • $ rm /the/file/path
  9. Search command history (very useful)

    • Ctrl + r and then type a search string.
  10. Previous commands

    • up and down arrows (duh)
  11. Write output to a file

    • $ echo hello > abc