Remove line from bash history


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


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

When the shell is not bash (sh) you can remove them from ~/.ash_history and then source the file.

Changing default editor for crontab from nano to vim


You would like to change the default editor for crontab from nano to vim.


Add the following to the ~/.selected_editor:


or run the select-editor and choose vim-basic (4)

server# select-editor 

Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/mcedit
  4. /usr/bin/vim.basic
  5. /usr/bin/vim.tiny

Choose 1-5 [2]: 4