LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   history clearance for a particular history number in linux (https://www.linuxquestions.org/questions/linux-software-2/history-clearance-for-a-particular-history-number-in-linux-792586/)

sangupari 03-02-2010 06:32 AM

history clearance for a particular history number in linux
 
hi
history -c will clear the previous history.
~.bash_history will contain the history commands
I want to know how to delete the particular history using the history number.
For eg:
.
.
.
440 cd
441 ls
442 history

then to delete the 440 th history how can i do it from the command line

neonsignal 03-02-2010 06:53 AM

You can use the '-d' flag
Code:

history -d 440

sangupari 03-03-2010 02:57 AM

thnx neon
how to delete a specific range of history?

from 440 to 442
the history has to be deleted...how to do that?

neonsignal 03-03-2010 03:08 AM

Quote:

from 440 to 442
the history has to be deleted...how to do that?
Code:

for i in {442..440}; do history -d $i; done
(note that the deletion is done in reverse)


All times are GMT -5. The time now is 08:28 PM.