Linux Error Exit Codes
Contents |
>ExampleComments1Catchall for general errorslet "var1 = 1/0"Miscellaneous errors, such as "divide by zero" and other
Linux Exit Codes
impermissible operations2Misuse of shell builtins (according to bash exit code check Bash documentation)empty_function() {}Missing keyword or command, or permission problem (and diff return code
Exit Code Python
on a failed binary file comparison).126Command invoked cannot execute/dev/nullPermission problem or command is not an executable127"command not found"illegal_commandPossible problem with $PATH or a typo128Invalid argument to exitexit 3.14159exit takes only integer args in the range 0 - 255 (see first footnote)128+nFatal error signal "n"kill -9 $PPID of script$? returns 137 (128 linux exit code 255 + 9)130Script terminated by Control-CCtl-CControl-C is fatal error signal 2, (130 = 128 + 2, see above)255*Exit status out of rangeexit -1exit takes only integer args in the range 0 - 255
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or
Bash Script Exit On Error
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss exit codes windows Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only
Linux Exit Code 1
takes a minute: Sign up Are there any standard exit status codes in Linux? up vote 213 down vote favorite 97 A process is considered to have completed correctly in Linux if its exit status was 0. I've seen that segmentation http://tldp.org/LDP/abs/html/exitcodes.html 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? linux exit-code share|improve this question edited Oct 10 at 8:41 Kyll 5,23652146 asked Jul 9 '09 at 5:24 Nathan Fellman 46.5k62191270 2 if you're looking for the thing called "system error number" returned by system functions http://stackoverflow.com/questions/1101957/are-there-any-standard-exit-status-codes-in-linux look here at errno –marinara Oct 21 '12 at 17:56 add a comment| 9 Answers 9 active oldest votes up vote 60 down vote accepted 8 bits of the return code and 8 bits of the number of the killing signal are mixed into a single value on the return from wait(2) & co.. #include
Aug 2004 on RedHat 7.3 #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* I/O error */ http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.html #define ENXIO 6 /* No such device or address */ #define E2BIG 7 /* Arg list http://unix.stackexchange.com/questions/110348/how-do-i-get-the-list-of-exit-codes-and-or-return-codes-and-meaning-for-a-comm too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file number */ #define ECHILD 10 /* No child processes */ #define EAGAIN 11 /* Try again */ #define ENOMEM 12 /* Out of memory */ #define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad address */ #define ENOTBLK 15 /* Block device required */ #define EBUSY 16 exit code /* Device or resource busy */ #define EEXIST 17 /* File exists */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* No such device */ #define ENOTDIR 20 /* Not a directory */ #define EISDIR 21 /* Is a directory */ #define EINVAL 22 /* Invalid argument */ #define ENFILE 23 /* File table overflow */ #define EMFILE 24 /* Too many open files */ #define ENOTTY 25 /* Not a typewriter */ #define ETXTBSY 26 /* Text file busy */ linux exit code #define EFBIG 27 /* File too large */ #define ENOSPC 28 /* No space left on device */ #define ESPIPE 29 /* Illegal seek */ #define EROFS 30 /* Read-only file system */ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ #define EDOM 33 /* Math argument out of domain of func */ #define ERANGE 34 /* Math result not representable */ #define EDEADLK 35 /* Resource deadlock would occur */ #define ENAMETOOLONG 36 /* File name too long */ #define ENOLCK 37 /* No record locks available */ #define ENOSYS 38 /* Function not implemented */ #define ENOTEMPTY 39 /* Directory not empty */ #define ELOOP 40 /* Too many symbolic links encountered */ #define EWOULDBLOCK EAGAIN /* Operation would block */ #define ENOMSG 42 /* No message of desired type */ #define EIDRM 43 /* Identifier removed */ #define ECHRNG 44 /* Channel number out of range */ #define EL2NSYNC 45 /* Level 2 not synchronized */ #define EL3HLT 46 /* Level 3 halted */ #define EL3RST 47 /* Level 3 reset */ #define ELNRNG 48 /* Link number out of range */ #define EUNATCH 49 /* Protocol driver not attached */ #define ENOCSI 50 /* No CSI structure available */ #define EL2HLT 51 /* Level 2 halted */ #define EBADE 52 /* Invalid exchange */ #define EBADR 53 /* Invalid request descriptor */ #define EXFULL 54 /* Exchange full */ #define ENOANO 55 /* No anode */ #define EBADRQ
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top How do I get the list of exit codes (and/or return codes) and meaning for a command/utility? up vote 5 down vote favorite 4 Is there a way I can do what stated in the title from the terminal commands, or will I have to look into the codes? command documentation exit share|improve this question edited Jan 22 '14 at 23:41 Gilles 372k696761127 asked Jan 22 '14 at 7:14 precise 4431917 add a comment| 3 Answers 3 active oldest votes up vote 5 down vote accepted There is no "recipe" to get the meanings of an exit status of a given terminal command. My first attempt would be the manpage: user@host:~# man ls Exit status: 0 if OK, 1 if minor problems (e.g., cannot access subdirectory), 2 if serious trouble (e.g., cannot access command-line argument). Second: Google. See wget as an example. Third: The exit statuses of the shell, for example bash. Bash and it's builtins may use values above 125 specially. 127 for command not found, 126 for command not executable. For more information see the bash exit codes. share|improve this answer edited Jan 24 '14 at 10:28 answered Jan 22 '14 at 7:46 chaos 27.5k65095 yeah some man, info, ... pages do include them.. and I was concerned with those who didn't. ..and I know a web research is always an option. ..as for now it appears it was just the bash exit codes I had to look for.. –precise Jan 22 '14 at 9:09 add a comment| up vote 6 down vote You will have to look into the code/documentation. However the thing that comes closest to a "standardization" is errno.h share|improve this answer answered Jan 22 '14 at 7:35 Thorsten Staerk 1,606517 thanks for pointing the header file.. tried looking into the documentation of a few utils.. hard time finding the exit codes, seems most will be the stderrs... –precise Jan 22 '14 at 9:13 1 errno.h is irrelevant when it comes to exit codes, only error messages. –Gilles