bash: history - Delete history at offset position.



  • Take into account the main readme for this section. README first.

    -d offset
    Delete the history entry at position offset. If offset is positive, it should be specified as it appears when the history is displayed. If offset is negative, it is interpreted as relative to one greater than the last history position, so negative indices count back from the end of the history, and an index of ‘-1’ refers to the current history -d command.
    

    Delete position 4. Negative positions can also be used.

    $ history
        1  who
        2  uptime
        3  dirs -l -v
        4  uptime
        5  history
    $ history -d 4
    

    The previous position 4, command uptime is now deleted from shell history.

    $ history
        1  who
        2  uptime
        3  dirs -l -v
        4  history
        5  history -d 4
        6  history
    

Log in to reply
 

© Lightnetics 2024