.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "FISH_COMMAND_NOT_FOUND" "1" "Nov 13, 2025" "4.2" "fish-shell" .SH NAME fish_command_not_found \- what to do when a command wasn't found .SH SYNOPSIS .nf \fBfunction\fP \fBfish_command_not_found\fP \&... \fBend\fP .fi .sp .SH DESCRIPTION .sp When fish tries to execute a command and can\(aqt find it, it invokes this function. .sp It can print a message to tell you about it, and it often also checks for a missing package that would include the command. .sp Fish ships multiple handlers for various operating systems and chooses from them when this function is loaded, or you can define your own. .sp It receives the full commandline as one argument per token, so $argv[1] contains the missing command. .sp When you leave \fBfish_command_not_found\fP undefined (e.g. by adding an empty function file) or explicitly call \fB__fish_default_command_not_found_handler\fP, fish will just print a simple error. .SH EXAMPLE .sp A simple handler: .INDENT 0.0 .INDENT 3.5 .sp .EX function fish_command_not_found echo Did not find command $argv[1] end > flounder Did not find command flounder .EE .UNINDENT .UNINDENT .sp Or the handler for OpenSUSE\(aqs command\-not\-found: .INDENT 0.0 .INDENT 3.5 .sp .EX function fish_command_not_found /usr/bin/command\-not\-found $argv[1] end .EE .UNINDENT .UNINDENT .sp Or the simple default handler: .INDENT 0.0 .INDENT 3.5 .sp .EX function fish_command_not_found __fish_default_command_not_found_handler $argv end .EE .UNINDENT .UNINDENT .SH BACKWARDS COMPATIBILITY .sp This command was introduced in fish 3.2.0. Previous versions of fish used the \(dqfish_command_not_found\(dq \fI\%event\fP instead. .sp To define a handler that works in older versions of fish as well, define it the old way: .INDENT 0.0 .INDENT 3.5 .sp .EX function __fish_command_not_found_handler \-\-on\-event fish_command_not_found echo COMMAND WAS NOT FOUND MY FRIEND $argv[1] end .EE .UNINDENT .UNINDENT .sp in which case fish will define a \fBfish_command_not_found\fP that calls it, or define a wrapper: .INDENT 0.0 .INDENT 3.5 .sp .EX function fish_command_not_found echo \(dqG\(aqday mate, could not find your command: $argv\(dq end function __fish_command_not_found_handler \-\-on\-event fish_command_not_found fish_command_not_found $argv end .EE .UNINDENT .UNINDENT .SH COPYRIGHT fish-shell developers .\" Generated by docutils manpage writer. .