Quantcast
Channel: How to delete history of last 10 commands in shell? - Stack Overflow
Viewing all articles
Browse latest Browse all 23

Answer by Wasef Anwar for How to delete history of last 10 commands in shell?

$
0
0
for h in $(seq $(history | tail -1 | awk '{print $1-N}')  $(history | tail -1 | awk '{print $1}') | tac); do history -d $h; done; history -d $(history | tail -1 | awk '{print $1}')

If you want to delete 10 lines then just change the value of N to 10.


Viewing all articles
Browse latest Browse all 23

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>