home.social

#bashshell — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #bashshell, aggregated by home.social.

  1. Fun #BashShell #LinuxTip for when you want to remove a bunch of similar commands from the bash history.

    > for i in `history | grep -i [part of command to remove] | cut -f 1 -d ' ' | sort -r ` ; do history -d ${i} ; done

    The [part of command to remove] should be enough so you find the commands you want to remove, without accidentally including others.

    The "sort -r" reverses the results so history deletes from the end, not the top. Very needed. #LearnedFromExperience

    #Linux #CLI #CommandLine