bash history

1
2
3
4
5
6
7
8
9
10
11
12
history
history n
history -n
history | grep xx
!n Expand to command with history number "n".
!-n Expand to command that was "n" number of commands before the current command in history.
!xxx execute the last command which start with xxx
!?xxx? execute the last command which contain "xxx"
!! Expand to the last command

touch /etc/hello
sudo !!

ctrl-R search bash