Bash-insulter, your system will insult the user by misspelling a command

About Bash-insulter

In the next article we are going to take a look at bash insulter. This is a command line script that I came across on Reddit. This is a fun CLI tool that randomly insults you when you type a wrong command. You can get a smile on these long working days. This tool is open source and its code is available in the official repository of Github.

This is a simple script that will make our system insult the user every time they type a Unix command incorrectly. With all this we are not going to improve our operating system, but it can be a lot of fun to use Bash-insulter to embarrass the user for any misspelled command in the terminal. We will be able to make it work in any Unix-like operating system containing BASH Shell.

We can configure the command "sudo”To insult the user when they enter the password incorrectly. This can be added to the responses that the system can give the user when they type the wrong command at the shell prompt.

Install Bash-insulter

In order to give a little bad language to our system, we will have to make sure we have installed GIT in our operating system. If we don't have it installed yet, we can use our system's default package manager to install it. For example, we can install GIT using the following command on any Debian-based system. To do this we open the terminal (Ctrl + Alt + T) and write:

sudo apt install git

Once git is installed we will be able to clone the Bash-insulter repository typing in the same terminal:

git clone https://github.com/hkbakke/bash-insulter.git bash-insulter

Once the previous action is finished, we can copy script to folder / etc / of our system. To do so, we just have to copy the following command in our terminal:

sudo cp bash-insulter/src/bash.command-not-found /etc/

Now to make it work, we will have to edit the /etc/bash.bashrc file. In the same terminal we are going to edit the file using vi (or whatever editor you like best). If you use vi, you can use the following command:

sudo vi /etc/bash.bashrc

Once the file is edited, we will only have to add the following lines. It is recommended to add these lines to the end of the file. It is also a good idea to leave a comment to identify what those lines are. You should end up having something like this:

bash-insulter etc bashrc

if [ -f /etc/bash.command-not-found ]; then
    . /etc/bash.command-not-found
fi

Save and close the file by typing : Wq. Once you log out, run the following command to update the changes:

source /etc/bash.bashrc

Testing bash-insulter

With the previous orders We already have the script installed in our Ubuntu. Now, if the user writes an incorrect command like the following, the terminal will put the batteries (depending on how you have it configured).

bad bash-insulter commands

lsss

cleaar

This is perhaps a good way to hold off and have a laugh when managing a system used by other users. The author of this script has added some "insults" that do not offend much. If we want we will be able to add our own insults as best we want.

Bash-insulter configuration

If we want to add new messages, we can do it by editing the file /etc/bash.command-not-found. For this we will have to write the following command in the terminal (Ctrl + Alt + T):

sudo vi /etc/bash.command-not-found

Once the file is edited, we can add the messages we want. We will have to place them within the local insult directive. We can also translate those that are already in the directive, since those that come by default are in English (and I particularly find it more funny that my operating system sends me messages in Spanish). I have to say that the messages that will be shown to us will be done in a random way.

During setup, I have added some slightly more aggressive insults. See in the screenshot below:

bash-insulter configuration

Notice

The author of this script is not responsible if he has offended someone's feelings, intentionally or accidentally. This script has been created purely for fun and entertainment.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   LeoLopez said

    But brother the script is in English, there is no Spanish version out there. It is a struggle to translate each insult, also some are typically Americanism !! 🙂

    1.    Damian Amoedo said

      I have not found it in Spanish, but translating it or adding your own is very simple and fast. So you save the "Americanisms." Salu2.

      1.    Nestor said

        #COPY THIS AND PASTE IT WITH THE SAME NAME, IT IS THE SAME FILE BUT I ALREADY #TRANSLATED IT AND ADD A FEW WORDS NOTHING ELSE
        print_message() {

        local messages
        local message

        messages = (
        "Boooo!"
        "You know nothing?"
        "RTFM!"
        "Haha, n00b!"
        "Wow! That was shockingly wrong! "
        "You are good dude!!!!"
        "The worst today!"
        "N00b alert!"
        "Your request for a reduced salary has been sent!"
        «Hahahahaha… che… wey”
        "You shit it !!!!!"
        "Hahaha ... please"
        "Uninstall please"
        "And the Darwin Prize goes to… $ {USER}!"
        "ERROR_INCOMPETENT_USER"
        "Incompetence is also a form of competition"
        "Bad."
        "Pretend until you get it!"
        "What is this …? Amateur hour? »
        "Come on, you can do it!"
        "Nice try."
        "What if ... you type a real command next time!"
        "What if I tell you that… it is possible to type valid commands?"
        "You don't speak a computer?"
        "This is not Windows"
        "Maybe you should leave the command line alone ..."
        "Please stay away from the keyboard wey !!"
        "Error code: 1D10T4"
        ACHTUNG! ALLES Turisten UND NONTEKNISCHEN LOOKENPEEPERS! DAS KOMPUTERMASCHINE IST NICHT FÜR DER GEFINGERPOKEN UND MITTENGRABEN! ODERWISE IST EASY schnappen DER SPRINGENWERK, BLOWENFUSEN UND POPPENCORKEN MIT SPITZENSPARKEN. IST NICHT FÜR GEWERKEN BEI DUMMKOPFEN. POCKETS DER RUBBERNECKEN SIGHTSEEREN KEEPEN DAS COTTONPICKEN HANDER at the DAS MUSS. ZO RELAXEN AND WATSCHEN DER BLINKENLICHTEN »
        "Pro tip: enter a valid command!"
        "To go outside."
        "This is not a search engine"
        «(╯ ° □ °) ╯︵ ┻━┻»
        "¯ \\ _ (ツ) _ / ¯"
        "So, I'm going to go ahead and run rm -rf / for you."
        "Because you are so stupid?!"
        "Maybe computers are not for you ..."
        "Why are you doing me this?!"
        "Do not you have anything better to do?"
        "I'm _ seriously_ considering 'rm -rf /' - ing myself ..."
        "That is why you can see your children only once a month"
        "That's why nobody likes you"
        "Are you even trying ?!"
        "Try using your brain next time!"
        "My keyboard is not a touch screen!"
        Commands, random gibberish, who cares!
        Typing wrong commands, huh?
        "Are you always that stupid or are you making a special effort today ?!"
        "It fell on your head like a baby, huh?"
        Brains are not everything. In your case they are nothing »
        "I don't know what makes you so stupid, but it really works."
        "You are not as bad as people say, you are much, much worse"
        «Two mistakes do not correct, take your parents as an example»
        "You must have been born on a highway because that's where most accidents happen."
        "If what you don't know cannot hurt you, you are invulnerable"
        "If ignorance is happiness, you must be the happiest person on earth"
        "You are proof that God has a sense of humor"
        "Keep trying, one day you'll do something smart!"
        "If shit were music, you'd be an orchestra"
        "How many times do I have to rinse before you go?"
        )

        # If CMD_NOT_FOUND_MSGS array is populated use those messages instead of the defaults
        [[-n $ {CMD_NOT_FOUND_MSGS}]] && messages = ("$ {CMD_NOT_FOUND_MSGS [@]}")

        # If CMD_NOT_FOUND_MSGS_APPEND array is populated append those to the existing messages
        [[-n $ {CMD_NOT_FOUND_MSGS_APPEND}]] && messages + = ("$ {CMD_NOT_FOUND_MSGS_APPEND [@]}")

        # Seed RANDOM with an integer of some length
        RANDOM = $ (od -vAn -N4 -tu & 2
        fi
        }

        function_exists() {
        # Zsh returns 0 even on non-existing functions with -F so use -f
        declare -f $ 1> / dev / null
        return$?
        }

        #
        # The idea below is to copy any existing handlers to another function
        # name and insert the message in front of the old handler in the
        # newhandler. By default, neither bash or zsh has has a handler function
        # defined, so the default behavior is replicated.
        #
        # Also, ensure the handler is only copied once. If we do not ensure this
        # the handler would add itself recursively if this file happens to be
        # sourced multiple times in the same shell, resulting in a never ending
        # stream of messages.
        #

        #
        #Zsh
        #
        if function_exists command_not_found_handler; then
        if! function_exists orig_command_not_found_handler; then
        eval "orig _ $ (declare -f command_not_found_handler)"
        fi
        else
        orig_command_not_found_handler() {
        printf "zsh: command not found:% s \\ n" "$ 1"> & 2
        return 127
        }
        fi

        command_not_found_handler() {
        print_message
        orig_command_not_found_handler "$ @"
        }

        #
        #Bash
        #
        if function_exists command_not_found_handle; then
        if! function_exists orig_command_not_found_handle; then
        eval "orig _ $ (declare -f command_not_found_handle)"
        fi
        else
        orig_command_not_found_handle() {
        printf "% s:% s: command not found \\ n" "$ 0" "$ 1"> & 2
        return 127
        }
        fi

        command_not_found_handle() {
        print_message
        orig_command_not_found_handle "$ @"
        }

  2.   Paulo Rodrigo Gomez said

    Look at Jannet Milagros
    It would be very educational haha

  3.   Ricar Dinho said

    Hahaha great