Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I type an invalid command in Bash, I get:

$ asdf
asdf: not found

I've been led to believe the "not found" message comes from a fallback executable that Bash calls when it can't find the command you enter. What is the name and path of this executable?

share|improve this question
Not /bin/bash? – Scott Mar 28 '11 at 7:25
No, it's bash that says so. (Mine even says so itself: bash: asdf: command not found). – MattBianco Mar 28 '11 at 9:32
up vote 3 down vote accepted

Further to Rena's answer, yes it is a function -- and you can replace it!

This link details how to do it. Fascinating post, actually. Just in time for April Fool's! sl command anyone?

Generously lifted from the linked article (for posterity) is this code snippet on placing this function in your .bashrc on an openSUSE platform:

command_not_found_handle() {

    export TEXTDOMAIN=command-not-found

    local cmd state rest
    local -i pid ppid pgrp session tty_nr tpgid

    # do not run when inside Midnight Commander or within a Pipe
    if test -n "$MC_SID" -o ! -t 1 ; then
        echo $"$1: command not found"
        return 127

    # do not run when within a subshell
    read pid cmd state ppid pgrp session tty_nr tpgid rest  < /proc/self/stat
    if test $$ -eq $tpgid ; then
        echo "$1: command not found"
        return 127

    # test for /usr/sbin and /sbin
    if test -x "/usr/sbin/$1" -o -x "/sbin/$1" ; then
        if test -x "/usr/sbin/$1" ; then prefix='/usr' ; else prefix='' ; fi
        echo $"Absolute path to '$1' is '$prefix/sbin/$1', so running it may require superuser privileges (eg. root)."
        return 127

    if test -n "$COMMAND_NOT_FOUND_AUTO" ; then
        # call command-not-found directly
        test -x /usr/bin/python && test -x /usr/bin/command-not-found && /usr/bin/python /usr/bin/command-not-found "$1" zypp
        # print only info about command-not-found
        echo -e $"If '$1' is not a typo you can use command-not-found to lookup the package that contains it, like this:\n    cnf $1"

    return 127
share|improve this answer

It is issued by bash itself. Try

strings `which bash` | fgrep found
share|improve this answer

Did some further digging and found out it's not an executable, but a function, command_not_found_handle() within Bash.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .