A process is considered to have completed correctly in Linux if its exit status was 0.
I've seen that segmentation faults often result in an exit status of 11, though I don't know if this is simply the convention where I work (the apps that failed like that have all been internal) or a standard.
Are there standard exit codes for processes in Linux?
Part 1: Advanced Bash Scripting Guide
As always, the Advanced Bash Scripting Guide has great information: (This was linked in another answer, but to a non-canonical URL.)
Part 2: sysexits.h
The ABSG references
sysexits.h
.On Linux:
There are no standard exit codes, aside from 0 meaning success. Non-zero doesn't necessarily mean failure either.
stdlib.h does define
EXIT_FAILURE
as 1 andEXIT_SUCCESS
as 0, but that's about it.The 11 on segfault is interesting, as 11 is the signal number that the kernel uses to kill the process in the event of a segfault. There is likely some mechanism, either in the kernel or in the shell, that translates that into the exit code.
'1' >>> Catchall for general errors
'2' >>> Misuse of shell builtins (according to Bash documentation)
'126'>>> Command invoked cannot execute
'127'>>>"command not found"
'128'>>> Invalid argument to exit
'128+n'>>>Fatal error signal "n"
'130'>>> Script terminated by Control-C
'255'>>>Exit status out of range
This is for bash. However, for other applications, there are different exit codes.
When Linux returns 0, it means success. Anything else means failure, each program has its own exit codes, so it would been quite long to list them all... !
About the 11 error code, it's indeed the segmentation fault number, mostly meaning that the program accessed a memory location that was not assigned.