LinuxCommandLibrary

errstr.1s

Convert error code to error string

SYNOPSIS

errstr [errnum ...]

DESCRIPTION

The errstr command is a utility primarily found on Solaris and some Unix-like systems that converts numeric error codes (errnos) into their corresponding descriptive error messages. It is invaluable for quick diagnostics during development, scripting, or troubleshooting when dealing with system call failures.

To use it, simply provide one or more decimal errno values as arguments. For instance, errstr 2 outputs "No such file or directory", while errstr 1 13 lists messages for multiple errors. If no arguments are supplied, it typically displays the message for errno 0 ("Error 0") or a usage hint.

errstr reads error numbers directly from the command line and matches them against the system's errno table, providing output in a concise, readable format. This avoids the need to consult manual pages or write custom code using functions like strerror(3).

Note: errstr is not a standard Linux command. On Linux distributions, use perror(1) for equivalent functionality, e.g., perror 2. It may be available via Solaris compatibility layers or specific packages, but compatibility varies.

CAVEATS

Not standard on Linux; use perror(1) instead. Limited to system's errno table; invalid errnos yield no output or errors.

EXAMPLE

errstr 2 13
No such file or directory
Permission denied

EXIT STATUS

0 on success, 1 if invalid errno or no match.

HISTORY

Originated in early Solaris releases (SunOS) as part of /usr/bin utilities for error diagnostics. Remains in modern Solaris/Illumos but absent from mainstream Linux.

SEE ALSO

perror(1), strerror(3)

Copied to clipboard