Command Line

Being proficient at the command line will save you a lot of time as a developer and help automate many of the tools we use on a day-to-day basis.

OS X / Unix / Linux

Most of these tips will work in any Unix / Linux environment including OS X.

Command History

  • The shell contains a history of many of the past commands you have executed in your terminal. You can avoid retyping these commands in a few ways

    • Up/Down Arrows: Pressing the up and down arrows will scroll through the history of commands you have run. Pressing enter while at any of these will re-execute that command. You may edit the command using the left/right arrow keys or the backspace key.
    • History Search: Before typing anything at a blank prompt press control-r and then the first few letters of a past command you have run, this will search backwards for the last command you ran that had those letters. Pressing left/right will allow you to edit the command and pressing enter will reexecute it
    • !! Typing !! on the command line on it's own will re-excute the last command you run
    • history Typing the command history will show you the history of commands you have run (up to some limit)