[que@hostname ~]$ mkdir /tmp/foo
[que@hostname ~]$ cd <the last argument from my last command is /tmp/foo>
[que@hostname ~]$ mkdir /tmp/foo
[que@hostname ~]$ cd !$
cd /tmp/foo
[que@hostname foo]$ pwd
/tmp/foo
[que@hostname foo]$
other examples:
[que@hostname ~]$ mkdir /tmp/a /tmp/b /tmp/c
[que@hostname ~]$ cd !:2
cd /tmp/b
[que@hostname b]$ pwd
/tmp/b
[que@hostname b]$
history hgrep
把下面这个函数加到 .bashrc 里面。
function hgrep () {
history | grep ${*:1}
}
source .bashrc
hgrep curl
就可以显示历史信息 比history | grep curl 方便点
522 curl localhost
668 curl 192.168.199.187
669 curl 192.168.199.187:8080
671 curl 192.168.199.187:8080
676 curl 192.168.199.87 :8080
677 curl 192.168.199.87:8080
678 curl 192.168.199.87 8080
679 curl 192.168.199.87 port 8080
680 curl -i 192.168.199.87 port 8080
689 curl 192.168.199.210
690 curl 192.168.199.187
691 curl 192.168.199.185
692 curl 192.168.199.184
693 curl 192.168.199.134
694 curl 192.168.199.196 8080
695 curl 192.168.199.196 80801
696 curl 192.168.199.196 8080
697 curl 192.168.199.196 port 8080
698 curl 192.168.199.196 port 8080c
699 curl 192.168.199.196 port 8080
700 curl 192.168.199.196
701 curl -I 192.168.199.196
702 curl -O 192.168.199.196
703 curl -O 192.168.199.196
741 curl 192.168.199.187 :8080
745 curl 192.168.199187:8080
746 curl 192.168.199.187:8080
996 curl http://www.l99.com
997 curl 192.168.199.186
998 curl 192.168.199.186:8080
999 curl 192.168.199.187:8080
1008 hgrep curl