Dry-run a Linux history command

Using verification (p) is generally a good idea if you're new to using the history command in production.

If you want to verify the command you're about to modify and run, you can use the p modifier at the tail end of a history modification.

$ !!:p
history
The command you see as a result is the expanded item from history, but it hasn't been run yet. You can run it manually, by pressing the Up arrow or Ctrl+P.

Comments