How do I recall a specific command from command history, without executing it
Solution 1:
You can do it like this: On the command prompt press Ctrl+r and then type the command you want to recall, in your case xyz
. This will show you the complete command without executing it.
Solution 2:
Try !xyz:p
; it will recall the command to the top of history without executing it, so eg up-arrow can immediately access it for interactive editing.
As an aside, I make a practice of doing this when recalling commands with a regexp that could conceivably dig up something damaging, ever since a hasty !r
, intended to recall the most recent rsync ...
command, pulled back and executed an rm *
that had been pushed to the stack more recently than the rsync.