Is there a trick to executing commands in the bash history. # history | grep long_command # exec 683 I've written a perl script that takes the bash history as stdin and then executes the command # history | /tmp/history.pl 683 Works but not an elegant solution.