If you want to remove one or more items from the shell history (list of commands that appear when you press the up arrow) do the following
First lets open the shell history and get the line ID of the item(s) we want to remove
history
Find the ID of the line(s) you want to remove, lets say for this example it’s on lines 324, 305 & 307
Now, issue the following command with line ID’s separated by spaces
history -d 324 305 307