Linux exit code, signal and errno lookup
Type an exit code such as 137, a signal such as 9 or SIGSEGV, or an errno value such as 111 or ECONNREFUSED, or paste the line that holds one. The page says what the number means as an exit status, as a signal and as an errno value, and which of them the line points to. It reads the text in your browser.
What an exit status says
A process ends with a number from 0 to 255 for the program that started it: zero means success and anything else means failure. A shell keeps the number of the last command in $?. Bash gives some numbers a meaning of its own:
| Exit status | What it means |
|---|---|
| 0 | Success. |
| 1 to 125 | The program's own failure codes: its documentation says what each means. |
| 2 | For a Bash builtin: it was used wrongly, such as with an option it does not know or a missing argument. |
| 126 | The command was found but is not executable, such as a file without execute permission. |
| 127 | The command was not found: a typing mistake, or a program that is not installed or not in PATH. |
| 128 + N | The process was ended by signal N: 137 is 128 + 9 (SIGKILL), 139 is 128 + 11 (SIGSEGV), 143 is 128 + 15 (SIGTERM). |
Only the lowest 8 bits of the number the program gives reach the program that waits for it, so exit 256 reports 0 and exit -1 reports 255.
Signals
The numbers of x86 and ARM Linux, with the exit status Bash reports when a signal ends a command, the GNU C Library's text for the signal and what the signal does when the program sets nothing else. SIGKILL and SIGSTOP cannot be caught, blocked or ignored. Pressing Ctrl+C in a terminal sends SIGINT, and the kernel's out-of-memory killer ends a process with SIGKILL. Some other processors, such as MIPS, Alpha and SPARC, number some signals differently.
| Signal | Name | Exit status | Text | Default action |
|---|---|---|---|---|
| 1 | SIGHUP | 129 | Hangup | Ends the process |
| 2 | SIGINT | 130 | Interrupt | Ends the process |
| 3 | SIGQUIT | 131 | Quit | Ends the process and writes a core dump |
| 4 | SIGILL | 132 | Illegal instruction | Ends the process and writes a core dump |
| 5 | SIGTRAP | 133 | Trace/breakpoint trap | Ends the process and writes a core dump |
| 6 | SIGABRT SIGIOT | 134 | Aborted | Ends the process and writes a core dump |
| 7 | SIGBUS | 135 | Bus error | Ends the process and writes a core dump |
| 8 | SIGFPE | 136 | Floating point exception | Ends the process and writes a core dump |
| 9 | SIGKILL | 137 | Killed | Ends the process |
| 10 | SIGUSR1 | 138 | User defined signal 1 | Ends the process |
| 11 | SIGSEGV | 139 | Segmentation fault | Ends the process and writes a core dump |
| 12 | SIGUSR2 | 140 | User defined signal 2 | Ends the process |
| 13 | SIGPIPE | 141 | Broken pipe | Ends the process |
| 14 | SIGALRM | 142 | Alarm clock | Ends the process |
| 15 | SIGTERM | 143 | Terminated | Ends the process |
| 16 | SIGSTKFLT | 144 | Stack fault | Ends the process |
| 17 | SIGCHLD | 145 | Child exited | Ignored |
| 18 | SIGCONT | 146 | Continued | Continues a stopped process |
| 19 | SIGSTOP | 147 | Stopped (signal) | Stops (pauses) the process |
| 20 | SIGTSTP | 148 | Stopped | Stops (pauses) the process |
| 21 | SIGTTIN | 149 | Stopped (tty input) | Stops (pauses) the process |
| 22 | SIGTTOU | 150 | Stopped (tty output) | Stops (pauses) the process |
| 23 | SIGURG | 151 | Urgent I/O condition | Ignored |
| 24 | SIGXCPU | 152 | CPU time limit exceeded | Ends the process and writes a core dump |
| 25 | SIGXFSZ | 153 | File size limit exceeded | Ends the process and writes a core dump |
| 26 | SIGVTALRM | 154 | Virtual timer expired | Ends the process |
| 27 | SIGPROF | 155 | Profiling timer expired | Ends the process |
| 28 | SIGWINCH | 156 | Window changed | Ignored |
| 29 | SIGIO SIGLOST SIGPOLL | 157 | I/O possible | Ends the process |
| 30 | SIGPWR | 158 | Power failure | Ends the process |
| 31 | SIGSYS SIGUNUSED | 159 | Bad system call | Ends the process and writes a core dump |
Real-time signals are 32 to 64 in the kernel. The GNU C Library keeps the first two or three for itself, so programs see SIGRTMIN as 34 or 35; a command ended by one reports 160 to 192.
errno values
When a system call fails, it sets errno to one of these numbers, and programs print the text that goes with it, such as connect: Connection refused. The numbers are those of x86 and ARM Linux, and the texts are the GNU C Library's. 41 and 58 are not used.
| Number | Name | Text |
|---|---|---|
| 1 | EPERM | Operation not permitted |
| 2 | ENOENT | No such file or directory |
| 3 | ESRCH | No such process |
| 4 | EINTR | Interrupted system call |
| 5 | EIO | Input/output error |
| 6 | ENXIO | No such device or address |
| 7 | E2BIG | Argument list too long |
| 8 | ENOEXEC | Exec format error |
| 9 | EBADF | Bad file descriptor |
| 10 | ECHILD | No child processes |
| 11 | EAGAIN EWOULDBLOCK | Resource temporarily unavailable |
| 12 | ENOMEM | Cannot allocate memory |
| 13 | EACCES | Permission denied |
| 14 | EFAULT | Bad address |
| 15 | ENOTBLK | Block device required |
| 16 | EBUSY | Device or resource busy |
| 17 | EEXIST | File exists |
| 18 | EXDEV | Invalid cross-device link |
| 19 | ENODEV | No such device |
| 20 | ENOTDIR | Not a directory |
| 21 | EISDIR | Is a directory |
| 22 | EINVAL | Invalid argument |
| 23 | ENFILE | Too many open files in system |
| 24 | EMFILE | Too many open files |
| 25 | ENOTTY | Inappropriate ioctl for device |
| 26 | ETXTBSY | Text file busy |
| 27 | EFBIG | File too large |
| 28 | ENOSPC | No space left on device |
| 29 | ESPIPE | Illegal seek |
| 30 | EROFS | Read-only file system |
| 31 | EMLINK | Too many links |
| 32 | EPIPE | Broken pipe |
| 33 | EDOM | Numerical argument out of domain |
| 34 | ERANGE | Numerical result out of range |
| 35 | EDEADLK EDEADLOCK | Resource deadlock avoided |
| 36 | ENAMETOOLONG | File name too long |
| 37 | ENOLCK | No locks available |
| 38 | ENOSYS | Function not implemented |
| 39 | ENOTEMPTY | Directory not empty |
| 40 | ELOOP | Too many levels of symbolic links |
| 42 | ENOMSG | No message of desired type |
| 43 | EIDRM | Identifier removed |
| 44 | ECHRNG | Channel number out of range |
| 45 | EL2NSYNC | Level 2 not synchronized |
| 46 | EL3HLT | Level 3 halted |
| 47 | EL3RST | Level 3 reset |
| 48 | ELNRNG | Link number out of range |
| 49 | EUNATCH | Protocol driver not attached |
| 50 | ENOCSI | No CSI structure available |
| 51 | EL2HLT | Level 2 halted |
| 52 | EBADE | Invalid exchange |
| 53 | EBADR | Invalid request descriptor |
| 54 | EXFULL | Exchange full |
| 55 | ENOANO | No anode |
| 56 | EBADRQC | Invalid request code |
| 57 | EBADSLT | Invalid slot |
| 59 | EBFONT | Bad font file format |
| 60 | ENOSTR | Device not a stream |
| 61 | ENODATA | No data available |
| 62 | ETIME | Timer expired |
| 63 | ENOSR | Out of streams resources |
| 64 | ENONET | Machine is not on the network |
| 65 | ENOPKG | Package not installed |
| 66 | EREMOTE | Object is remote |
| 67 | ENOLINK | Link has been severed |
| 68 | EADV | Advertise error |
| 69 | ESRMNT | Srmount error |
| 70 | ECOMM | Communication error on send |
| 71 | EPROTO | Protocol error |
| 72 | EMULTIHOP | Multihop attempted |
| 73 | EDOTDOT | RFS specific error |
| 74 | EBADMSG EFSBADCRC | Bad message |
| 75 | EOVERFLOW | Value too large for defined data type |
| 76 | ENOTUNIQ | Name not unique on network |
| 77 | EBADFD | File descriptor in bad state |
| 78 | EREMCHG | Remote address changed |
| 79 | ELIBACC | Can not access a needed shared library |
| 80 | ELIBBAD | Accessing a corrupted shared library |
| 81 | ELIBSCN | .lib section in a.out corrupted |
| 82 | ELIBMAX | Attempting to link in too many shared libraries |
| 83 | ELIBEXEC | Cannot exec a shared library directly |
| 84 | EILSEQ | Invalid or incomplete multibyte or wide character |
| 85 | ERESTART | Interrupted system call should be restarted |
| 86 | ESTRPIPE | Streams pipe error |
| 87 | EUSERS | Too many users |
| 88 | ENOTSOCK | Socket operation on non-socket |
| 89 | EDESTADDRREQ | Destination address required |
| 90 | EMSGSIZE | Message too long |
| 91 | EPROTOTYPE | Protocol wrong type for socket |
| 92 | ENOPROTOOPT | Protocol not available |
| 93 | EPROTONOSUPPORT | Protocol not supported |
| 94 | ESOCKTNOSUPPORT | Socket type not supported |
| 95 | EOPNOTSUPP | Operation not supported |
| 96 | EPFNOSUPPORT | Protocol family not supported |
| 97 | EAFNOSUPPORT | Address family not supported by protocol |
| 98 | EADDRINUSE | Address already in use |
| 99 | EADDRNOTAVAIL | Cannot assign requested address |
| 100 | ENETDOWN | Network is down |
| 101 | ENETUNREACH | Network is unreachable |
| 102 | ENETRESET | Network dropped connection on reset |
| 103 | ECONNABORTED | Software caused connection abort |
| 104 | ECONNRESET | Connection reset by peer |
| 105 | ENOBUFS | No buffer space available |
| 106 | EISCONN | Transport endpoint is already connected |
| 107 | ENOTCONN | Transport endpoint is not connected |
| 108 | ESHUTDOWN | Cannot send after transport endpoint shutdown |
| 109 | ETOOMANYREFS | Too many references: cannot splice |
| 110 | ETIMEDOUT | Connection timed out |
| 111 | ECONNREFUSED | Connection refused |
| 112 | EHOSTDOWN | Host is down |
| 113 | EHOSTUNREACH | No route to host |
| 114 | EALREADY | Operation already in progress |
| 115 | EINPROGRESS | Operation now in progress |
| 116 | ESTALE | Stale file handle |
| 117 | EUCLEAN EFSCORRUPTED | Structure needs cleaning |
| 118 | ENOTNAM | Not a XENIX named type file |
| 119 | ENAVAIL | No XENIX semaphores available |
| 120 | EISNAM | Is a named type file |
| 121 | EREMOTEIO | Remote I/O error |
| 122 | EDQUOT | Disk quota exceeded |
| 123 | ENOMEDIUM | No medium found |
| 124 | EMEDIUMTYPE | Wrong medium type |
| 125 | ECANCELED | Operation canceled |
| 126 | ENOKEY | Required key not available |
| 127 | EKEYEXPIRED | Key has expired |
| 128 | EKEYREVOKED | Key has been revoked |
| 129 | EKEYREJECTED | Key was rejected by service |
| 130 | EOWNERDEAD | Owner died |
| 131 | ENOTRECOVERABLE | State not recoverable |
| 132 | ERFKILL | Operation not possible due to RF-kill |
| 133 | EHWPOISON | Memory page has hardware error |
| 134 | EFTYPE | Inappropriate file type or format |
The ones people meet most
| Name | What it usually means |
|---|---|
EPERM | The operation needs a privilege the process does not have, whatever the file's permissions say. |
ENOENT | A file or folder in the path does not exist. |
EACCES | The permissions of a file or folder in the path do not allow it. |
ENOSPC | The file system or device is full. |
EADDRINUSE | Another socket already uses that local address and port. |
ECONNRESET | The other end reset the connection. |
ETIMEDOUT | The connection attempt timed out: nothing answered in time. connect(2) adds that the server may be too busy to accept new connections. |
ECONNREFUSED | Nothing listens on that address and port: connect(2) says the connect found no one listening on the remote address. |
EHOSTUNREACH | No route to the host. |
ENETUNREACH | The network is unreachable from here. |
Sources
- Signal and errno numbers and the kernel's errno comments: the Linux kernel's user-space headers (include/uapi/asm-generic and arch/x86, Linux v7.3); the out-of-memory killer: mm/oom_kill.c (the same release).
- Texts: the GNU C Library's lists of signal and errno texts (sysdeps/generic/siglist.h and sysdeps/gnu/errlist.h, at commit 04e750e of a mirror of the library), under the GNU Lesser General Public License 2.1 or later.
- Default actions, real-time signals, the 8 bits of the exit status, Ctrl+C, and the meanings of ECONNREFUSED and ETIMEDOUT: the Linux man-pages project's signal(7), exit(3), wait(2), termios(3) and connect(2) (commit ae6b221 of its mirror).
- Exit statuses 0, 2, 126, 127 and 128 + N: the GNU Bash Reference Manual, section 3.7.5 Exit Status.
More Linux tools
-
curl error code lookup
Read curl: (6), (7), (28), (35), (60) or any other curl error, with libcurl's name and what to check.
-
OpenSSL verify errors and command builder
Read verify error:num=20 and the others in plain words, and build openssl commands for PFX, PEM and CSRs.
-
chmod and umask calculator
Turn 755 into rwxr-xr-x and back, build a chmod command, and see what a umask leaves on new files.
-
Cron expression explainer
Read a crontab line such as */15 8-18 * * 1-5 in words, see its next runs, or build a schedule.