Linux Error Codes

By Priya PedamkarPriya Pedamkar

Linux Error Codes

Introduction to Linux Error codes

In the Linux operating system, we are working on many components. While working, we are getting lots of errors. The same errors can be acknowledged by the Linux error codes. There are different error codes available as per the execution error. We can capture the error code with the help of the “echo” command also.

To fix the error message in the Linux level jobs/query or application-level job, it is mandatory that we need to understand the nature of the error, the error description, and the error code. Accordingly, we can fix the application or job on the Linux level.

Web development, programming languages, Software testing & others

The error code utility i. e., “errno” is written by the Lars Wirzenius.

Syntax of Error Codes

errno [ OPTION ] [ STRING ] echo $?

  • errno: We can use the “errno” keyword in the syntax or command. It will take the two arguments as access OPTION and the string. As per the provided arguments, it will provide the error information as per the string or the error code.
  • OPTION: We can provide the different flags as options that are compatible with the “errno” command.
  • STRING: We can provide the short string as per the “error” define. It will provide the error information concerning the provided string.
  • echo $?: The echo command will also provide the error code. We need to use the “?” symbol with the echo command.

How Linux Error Codes Works?

In Linux, we are having a total of 134 error codes. Every error message or the failure in the Linux environment, it will have their error code. With the help of error code, we can fetch the error description and help to fix the issue or error message. If we will keep the same error message as it is then it will be a big impact on the server level.

When we are executing any command or job on the Linux level without any error then it will be fine. But if the Linux command will not be executed properly then the Linux compiler will notify with the relevant error message to the login user.

Below are the lists of error code information available,

Sr No Error Code Error Number Error Description
1 EPERM 1 It will print the error message if the operation is not permitted.
2 ENOENT 2 It will print the error message if there are no such files or directory exists.
3 ESRCH 3 It will print the error message if there is no such process exists.
4 EINTR 4 It will print the error message if any interrupted system calls.
5 EIO 5 It will print the error message if it is any input/output error.
6 ENXIO 6 It will print the error message if there is no such device or address exists.
7 E2BIG 7 It will print the error message if the argument list is too long.
8 ENOEXEC 8 It will print the error message if there is an exec format error.
9 EBADF 9 It will print the error message in it is a bad file descriptor.
10 ECHILD 10 It will print the error message if there are no child process exits.

Examples to implement Linux Error codes

Here are the following examples mention below

Examples #1 – Print the List

The “errno” utility is a very simple and common way to check the list of error codes in a Linux environment. It will print all the list of error codes with the error number and error description.

Источники:

https://www. educba. com/linux-error-codes/

Понравилась статья? Поделиться с друзьями:
Добавить комментарий

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: