Searching through passed Logfile with something like this:cat /path/to/logfile | grep -iEw 'some-ip-address-here|correspondig-mac-adress-here'This gives me all the passed log lines until now so I can see what has been. Now I also want to see what's going on so I need to exchange cat with tail -f giving me this:tail -f /path/to/logfile | grep -iEw 'some-ip-address-here|correspondig-mac-adress-here'
Is there a shortcut to rerun a command with arguments from last command (not cd, ls or echo)
bash;command line;command history
You can use !!:* to refer to all the words but the zeroth of the last command line.!! refers to the previous command, : separates the event specification from the word designator, * refers to all the words but the zeroth.This is from the HISTORY EXPANSION section of bash(1).wieland@host in ~ cat foo | grep barbarwieland@host in ~ tail -f !!:*tail -f foo | grep barbarYou could also use quick substitution where ^string1^string2^ repeats the last command, replacing string1 with string2:wieland@host in ~ cat foo | grep barbarwieland@host in ~ ^cat^tail -ftail -f foo | grep barbar