Quantcast
Viewing latest article 18
Browse Latest Browse All 23

Answer by Ghassan Zein for How to delete history of last 10 commands in shell?

First, type: history and write down the sequence of line numbers you want to remove.

To clear lines from let's say line 1800 to 1815 write the following in terminal:

$ for line in $(seq 1800 1815) ; do history -d 1800; done

If you want to delete the history for the deletion command, add +1 for 1815 = 1816 and history for that sequence + the deletion command will be deleted.

For example :

$ for line in $(seq 1800 1816) ; do history -d 1800; done

Viewing latest article 18
Browse Latest Browse All 23

Trending Articles