If your search terms are a bit more complicated / not contiguous, another option is grep among history results, for example:
history 300 | grep scp | grep important$
This will return a list of commands in your history that match, for example:
3323 scp file1 user10@192.168.10.1:/home/user1/linuxfiles/samplecode/important 3325 scp file1 user10@192.168.10.1:/home/user1/winfiles/samplecode/important
Then you can execute the corresponding command with !3325 .
I sometimes find this useful when running many of these commands, and you may have to press Ctrl + R repeatedly to return to the exact command.
Bonlenfum Jan 10 '13 at 2:31
source share