April 18, 2015 · bash

Shortcuts to access the previous console command

These are some interesting bash shortcuts to remember to help us access to our last command easuly:

!^ = the first argument from the previous command

!$ = the last argument from the previous command

!* = all of the arguments from the previous command

!! = the entire previous command

For example:

  $ apt-get install foo
  Error you must be root
  $ sudo !!
  Installing foo...
  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket
Comments powered by Disqus