Hacker News new | ask | show | jobs
by dclowd9901 4715 days ago
You just gave me 2 more years back.
3 comments

Heh, no problem here are 2 more bang tricks. !<charachters> runs the last command you ran that starts with the characters you type.

  !gre      # will run the last command starting with gre (so probably grep)
If you type history, then !<number to the left of the history command>, the shell will execute that command.

  $ history # shows command history
  $ !200    # executes command 200
Keep them coming, imagine the manyears you're recovering!
You can also press Up arrow, Ctrl-A to go back to the beginning of the line, add "sudo " and enter. This type of thing also works in most REPLs (Python, irb, Node, etc.)
Bash/csh have a wonderful history expansion feature[0]. I can never remember all of the modifiers, but I am learning them slowly.

[0]: https://www.gnu.org/software/bash/manual/bashref.html#Event-...