sysexits.h(3head)
π sysexits.h β exit codes for programs
okay bestie, pull up a chair πͺ because this is the <sysexits.h> page, from section 3head, and honestly? it's the blueprint for β¨how a program tells you what went wrongβ¨. exit codes, but make them mean something. no more mysterious 1s. periodt.
π LIBRARY
Standard C library (libc) π«Ά
β¨ SYNOPSIS β¨
like, here's the whole vibe, verbatim, no cap:
#include <sysexits.h>
#define EX_OK 0 /* successful termination */
#define EX__BASE 64 /* base value for error messages */
#define EX_USAGE 64 /* command line usage error */
#define EX_DATAERR 65 /* data format error */
#define EX_NOINPUT 66 /* cannot open input */
#define EX_NOUSER 67 /* addressee unknown */
#define EX_NOHOST 68 /* host name unknown */
#define EX_UNAVAILABLE 69 /* service unavailable */
#define EX_SOFTWARE 70 /* internal software error */
#define EX_OSERR 71 /* system error (e.g., can't fork) */
#define EX_OSFILE 72 /* critical OS file missing */
#define EX_CANTCREAT 73 /* can't create (user) output file */
#define EX_IOERR 74 /* input/output error */
#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry
*/
#define EX_PROTOCOL 76 /* remote error in protocol */
#define EX_NOPERM 77 /* permission denied */
#define EX_CONFIG 78 /* configuration error */
#define EX__MAX ... /* maximum listed value */
look at all those little constants π they're all just macros, they cost you nothing at runtime, and they make your program legible. we love a free glow-up π
π¦ DESCRIPTION
so, a few programs exit with these following error codes. that's the whole premise. π
The successful exit is always indicated by a status of 0, aka EX_OK (which is the same thing as EXIT_SUCCESS from <stdlib.h> β they're besties, they're literally the same). π
Error numbers begin at EX__BASE so there's less chance of clashing with other exit statuses that random programs might already be returning. like, the low numbers were taken, okay?? π so we start at 64 and go up from there. iconic behavior honestly.
The meaning of the code is approximately as follows:
EX_USAGEβ the command was used incorrectly, i.e. wrong number of arguments, a bad flag, bad syntax in a parameter, or whatever. you fumbled the invocation, bestie. πEX_DATAERRβ the input data was incorrect in some way. only use this for the user's data, not for system files. user data problems get user data codes. πEX_NOINPUTβ an input file (not a system file!) didn't exist or wasn't readable. this could also cover errors like"No message"to a mailer (if it even cared to catch it). πEX_NOUSERβ the user you specified didn't exist. this might be used for mail addresses or remote logins. that person? not real. πEX_NOHOSTβ the host you specified didn't exist. this one is used in mail addresses or network requests. π°οΈEX_UNAVAILABLEβ a service is unavailable. happens if a support program or file doesn't exist. this one is also the catch-all for when something you wanted to do just... doesn't work, and you genuinely don't know why. the "idk it's giving broken" code π«EX_SOFTWAREβ an internal software error has been detected. if possible, keep this limited to non-operating-system-related errors. it's a you problem, not a kernel problem, iykyk.EX_OSERRβ an operating system error has been detected. this is intended for stuff like"cannot fork","cannot create pipe", or the like. it also includes things likegetuid(2)returning a user that doesn't exist in thepasswd(5)file. π΅ the OS itself is acting up.EX_OSFILEβ some system file (e.g./etc/passwd,/etc/utmp, etc.) doesn't exist, can't be opened, or has some sort of error (e.g. a syntax error). π missing/broken system file energy.EX_CANTCREATβ a (user-specified) output file cannot be created. the write just isn't writing. πEX_IOERRβ an error occurred while doing I/O on some file. something went sideways mid-read or mid-write. πEX_TEMPFAILβ temporary failure, indicating something that isn't really an error. for example, a mailer couldn't create a connection, and the request should be reattempted later. try again later, it's not you it's the moment β¨EX_PROTOCOLβ the remote system returned something that was"not possible"during a protocol exchange. the other side said something that literally cannot happen. rude. π€EX_NOPERMβ you didn't have sufficient permission to perform the operation. not intended for file system problems β those should useEX_NOINPUTorEX_CANTCREATβ but rather for higher level permissions. know the difference, bestie. πEX_CONFIGβ something was found in an unconfigured or misconfigured state. the config file ate and left no crumbs (complimentary? no. it's broken). π§
The numerical values corresponding to the symbolical ones are given in parenthesis for easy reference. like a little cheat sheet, built right in. π
π STANDARDS
BSD. π that's it, that's the standard.
π°οΈ HISTORY
The <sysexits.h> file appeared in 4.0BSD for use by the deliverymail utility, which was later renamed to sendmail(8). so it's genuinely a nepo baby of the mail world π and it's been serving ever since.
β οΈ CAVEATS
The choice of an appropriate exit value is often ambiguous. π fr fr. you'll be staring at EX_SOFTWARE vs EX_OSERR at 3am like... which one am i. nobody knows. vibe check failed.
π SEE ALSO
and that's the whole page, bestie β go forth and exit meaningfully ππ¦β¨
this was sysexits.h(3head) from Linux man-pages 6.20, dated 2026-10-11 π slay, stay iconic, and always #include <sysexits.h> ππ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: BSD-2-Clause
- Copyright 1996, Joerg Wunsch
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms