Typing !string executes the last command that starts with 'string'. But how do you do that when there is a space in your command line ?
paul@laika:~$ history | grep dsl | tail -5
4841 ssh dsl@172.16.122.129
4847 ssh dsl@172.16.122.129
4923 ssh dsl@172.16.122.129
4950 ssh dsl@172.16.122.129
4999 history | grep dsl | tail -5
paul@laika:~$ !'ssh dsl'
bash: !'ssh: event not found
paul@laika:~$ !"ssh dsl"
bash: !"ssh: event not found
paul@laika:~$ !ssh\ dsl
bash: !ssh\: event not found
paul@laika:~$ "!ssh dsl"
"ssh 192.168.1.38 dsl"
bash: ssh 192.168.1.38 dsl: command not found
paul@laika:~$
I want to recall the last ssh connection, based on the username i used...
EDIT: the answer is !?ssh dsl?
2 comments:
Usually I just type ^R to search in my history, i find this easier then the '!' commands (except the basic ones like '!!','!$'; I use those frequently), and you can type spaces in it ;-)
!?ssh d
Post a Comment