Terminal

« Go back to Cheatsheets

General

  • pwd - shows current directory path
  • ls - lists the files in the currrent path
  • touch <filename.extension> - creates new file in the current path
  • cd <path> - checkout to the path

Terminal command - Navigate

  • ctrl + a - to move cursor to beginning of line
  • ctrl + e - to move cursor to end of line

Terminal command - Delete

  • ctrl + w - to delete the last word
  • ctrl + u - to delete all the way back to the start of the line
  • ctrl + k - to delete to the end of the line

Permission

  • sudo chgrp -R admin /usr/local - set write permission for admin for certain dir
  • sudo chown -R $(whoami) /usr/local - makes /usr/local writeable for user

Kill all process running on a port

  • lsof -ti:9000 | xargs kill - where 9000 is the port number here

Advanced

  • ctrl + r - search through command history (after pressing, type to search, press ctrl-r repeatedly to cycle through more matches, press Enter to execute the found command, or hit the right arrow to put the result in the current line to allow editing)

Comments