I have following command to clear last entry of bash history(terminal history/command-line history). My Ubuntu 14.04 Trusty Tahr.
sed -i '$d' ~/.bash_history
But I want to keep last
1,2...n entries and delete the rest, how can I achieve that ?
Can be with
awk or any other command, no problem as far as the requirements are met.