In some terminals you can do something like this...
Type some command
nmap -sn 192.168.1.1/24
Then go on to do other things in the terminal for a while. Then later you can type
nmap
and then just press the ↑ key and it will index through all of the commands that started with what you typed, in this case nmap
for example.
My example was pretty short but sometimes you type a very long command that you want to run again, and I know you can press ↑ until you find it again, but that goes through every command and could take a while if you typed it long ago.
Is there anyway to get this to work in Ubuntu's Terminal?
!
? Just in case: you can always type!nmap
and this will execute the first command in the history that matchesnmap
. If you remember enough part of the command it can be faster than manually searching with arrows. Moreover you can modify the command using substitutions!nmap:s/something/something-else/
. Although this doesn't request confirmation for execution of the command, so you'll see what is going to happen only when it's already started.