Remove line from bash history

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You want to remove a certain line from your server’s bash history, if for example you pasted a password in the wrong place.

Solution

Use the two steps:

1. history -d line_number to remove from memory
2. history -w to write in-memory history to the history file ~/.bash_history

as described here