Be vary of entering commands from history (Arrow Up), especially if you did a destructive command not long ago.

Did this in a database for a game. I cleaned the clan tables not long before release. Then a short while after the release I searched for a clan related query and ended up clearing one of the tables again (ofc on autocommit). :|

So had to delete the related tables and notified people they had to claim their clan name yet again really quick.


Never had the issue on linux yet, but I'm usually vary when doing a generic destructive command (like "rm -r *"). The problem rarely happens with zsh (you can arrow up based on what you already typed) but I'm often still vary and prefix the command with a space to prevent it showing up in my history.

  • 0
    @AtuM Yeah.

    I usually have the problem under normal circumstances as well. When the search command is like 30 "arrows" away, I'll usually just skim each line for some word and also just enter it the second I spot it.

    Just bad when the command was not what I expected...

    It's like a bad reflex.
  • 1
    @LinusCDE wow, that's an extremely convoluted reflex then...
  • 1
    (Do not) Just run "source .bash_history" to prevent it from happening again. By probably breaking your system. Don't run it.
  • 0
    @zvyn @vintprox @AtuM

    Yeah. Zsh makes it pretty easy to avoid accidentially encountering a "rm" when I just arrow for "sudo nano" or similar.

    Luckily I rarely every actually do arrow rm's or things that could contain it (like "sudo"). The MYSQL-Lesson seems luckily still ingrained in me.
  • 1
    @synemeup That seems pretty horrible to do. Seems as deadly as a "rm -rf /" depending on your user or after how many commands a "sudo" might stop you.
  • 1
    You could also explicitly name the path you’re deleting hehe
Add Comment