Tech Tips

Delete Last Command from Bash History

If you’re like me, on occasion you accidentally (or sometimes purposefully) include a password in a command. Until recently I would execute history , find the offending command’s number, then do a history -d NUMBER . It is kind of a pain.

The following deletes the last item in your bash history:

You can create an alias for this, type it manually (umm, no thanks), or, as is the case for me, create a Keyboard Maestro macro for it. Here’s what my macro looks like:

img20141208190438

Leave a Reply

Your email address will not be published.