All the exit codes and status in C

All the exit codes and status in C

I came across this when doing the shell project.
There was only two available to me 126(permission) and 127(command not found)

So I started researching, trying to find other exit codes, so many websites gave different meanings for different exit codes, but most of them were the same with slight differences, so I will say the exit codes you will see here are not 100% correct. research on this topic is still ongoing
some codes may appear two times, it's intentional

0: Success
1: Catchall for general errors
2: Misuse of shell built-ins (for example, cd command)
3: Incorrect command line arguments
4: System call failed
5: Fatal error signal SIGTERM
6: Trace/Breakpoint trap
7: Process terminated by SIGKILL
8: Process aborted by SIGFPE
9: Process aborted by SIGPIPE
10: Process aborted by SIGBUS
11: Process aborted by SIGSEGV
12: Incorrect or unknown system call
13: Process aborted by SIGPIPE
14: Timer expired
15: Termination by SIGTERM
16: Background process attempting to read from tty (shell-specific)
17: Background process attempting to write to tty (shell-specific)
18: Exited due to an error signal
19: Control-C or equivalent termination signal
20: Parent shell exited
21: Script terminated by set -e option
22: Subshell terminated by exec command
23: Failed to execute exit command
24: Syntax error: invalid if statement
25: Syntax error: invalid elif statement
26: Syntax error: invalid else statement
27: Syntax error: missing fi statement
28: Syntax error: unexpected EOF while looking for matching "
29: Syntax error: unmatched "
30: Syntax error: unexpected ( or ) in if statement
31: Syntax error: invalid while statement
32: Syntax error: invalid until statement
33: Syntax error: missing do statement in for or while loop
34: Syntax error: missing done statement in for or while loop
35: Syntax error: invalid case statement
36: Syntax error: invalid esac statement
37: Syntax error: missing ;; in case statement
38: Syntax error: unexpected ) in case statement
39: Syntax error: unexpected | in case statement
40: Syntax error: invalid function declaration
41: Syntax error: invalid return statement
42: Syntax error: invalid continue statement
43: Syntax error: invalid break statement
44: Syntax error: invalid source command
45: Syntax error: invalid . command
46: Syntax error: invalid exec command
47: Invalid argument to shift command
48: Invalid option to set command
49: Invalid trap command argument
50: Attempt to use unset command on special built-in variable

/* 0: Successful execution.
1: General unspecified error.
2: Misuse of shell builtins (according to Bash documentation).
3: Internal command or script invocation error.
4: Nonexistent command, bad filename, or illegal format syntax.
5: Exit failure status from shell commands or utilities.
6: Incorrect permissions or bad arguments passed to a shell built-in command or a script.
7: Shell encountered an error while executing its built-in commands.
8: Filename argument expected, but not provided.
9: File descriptor error, such as using the wrong number of arguments for a command that requires input from a file descriptor.
10: File descriptor was closed while the shell command was still reading from it.
11: Syntax error in a shell command or script.
12: Shell command exceeded the system's maximum allowable size.
13: Shell command not found.
14: Internal failure in the shell, such as a missing keyword or operator.
15: Shell command terminated with a signal, such as SIGTERM.
16: Error in arithmetic operation, such as division by zero.
17: Misuse of shell built-ins, as per the Bash documentation.
18: Attempt to execute a read-only file system or directory.
19: Attempt to execute a directory as if it were a file.
20: Attempt to execute a non-executable file.
21: Attempt to execute a file that has been marked as non-executable.
22: Incorrect file format for executable file.
23: Error in a piped command.
24: Attempt to execute an invalid system call.
25: Attempt to execute a command that was terminated due to a signal.
26: Incorrect password entered when using a password-protected command.
27: Attempt to execute a command without sufficient privileges.
28: Script or command ran out of disk space.
29: Attempt to execute a command on a remote machine without proper authorization.
30: Attempt to execute a command on a remote machine that does not exist.
31: Attempt to execute a command on a remote machine that is not available.
32: Attempt to execute a command with an invalid or unrecognized option.
33: Attempt to execute a command with an invalid argument.
34: Attempt to execute a command with an invalid environment variable.
35: Attempt to execute a command with an environment variable that contains illegal characters.
36: Attempt to execute a command with an invalid working directory.
37: Attempt to execute a command that requires a terminal.
38: Attempt to execute a command that is not currently available or installed.
39: Attempt to execute a command with an invalid or unrecognized signal.
40: Attempt to execute a command with an invalid or missing option argument.
41: Attempt to execute a command with an invalid or missing argument value.
42: Attempt to execute a command with an invalid or missing option parameter.
43: Attempt to execute a command that is not compatible with the current shell.
44: Attempt to execute a command with an invalid or missing input file.
45: Attempt to execute a command with an invalid or missing output file. 46: Attempt to execute a command that has an invalid or missing redirection.
47: Attempt to execute a command with an invalid or missing input/output format.
48: Attempt to execute a command that requires a specific kernel module */

50 - Reserved

51 - Attempt to invoke a function or execute a file that is not executable

52 - System error (e.g., cannot allocate memory or open file)

53 - A command is not found

54 - Invalid or incomplete argument list

55 - Too many open files in system

56 - I/O error

57 - Inappropriate I/O control operation

58 - Fatal signal detected (e.g., segmentation fault or bus error)

59 - Bad user name or user ID

60 - An application program error (e.g., division by zero)

61 - Attempt to use a file descriptor that is out of range

62 - A remote machine refused the network connection

63 - Maximum file size exceeded

64 - A command to be executed is a directory

65 - A failure has occurred in a routine that creates processes

66 - The quota system is used up

67 - An attempt to write on a pipe with no one to read it

68 - An attempt to open a pipe for writing that is not open for reading

69 - Too many users

70 - Disk quota exceeded

71 - No medium found

72 - An error occurred while changing directory

73 - An error occurred while reading the contents of a file

74 - An error occurred while writing the contents of a file

75 - An error occurred while locking a file

76 - An error occurred while unlocking a file

77 - An attempt to access a symbolic link failed

78 - A hard link cannot be created to a directory

79 - An error occurred while creating a directory

80 - An error occurred while removing a directory

81 - An error occurred while accessing a file or directory

82 - An error occurred while changing the ownership of a file or directory

83 - An error occurred while changing the permissions of a file or directory

84 - An error occurred while setting the sticky bit of a directory

85 - An error occurred while setting the setgid bit of a directory

86 - An error occurred while setting the setuid bit of a directory

87 - An error occurred while deleting a file

88 - An error occurred while renaming a file

89 - An error occurred while creating a file

90 - An error occurred while copying a file

91 - An error occurred while moving a file

92 - An error occurred while linking a file

93 - An error occurred while unlinking a file

94 - An error occurred while seeking a file

95 - An error occurred while truncating a file

96 - An error occurred while determining the size of a file

97 - An error occurred while determining the type of a file

98 - An error occurred while determining the access rights of a file

99 - An error occurred while determining the modification time of a file

100 - An error occurred while determining the status of a file
100: Command not found
101: Cannot open input file
102: Permission denied
103: Invalid argument
104: Not a directory
105: No child processes
106: Not a regular file
107: Directory not empty
108: Too many open files
109: Broken pipe
110: Timer expired
111: Operation not permitted
112: No space left on device
113: Resource temporarily unavailable
114: Bad address
115: Network is unreachable
116: Connection refused
117: Host is down
118: Connection timed out
119: Host is unreachable
120: File exists
121: Read-only file system
122: Invalid argument or option
123: Remote I/O error
124: Unknown error
125: Protocol error
126: Permission denied (more specific than code 102)
127: Command not found (more specific than code 100)
128: Invalid exit argument
129: Hangup
130: Interrupted by signal
131: Terminated by signal
132: Aborted 133: Bus error
134: Segmentation fault
135: Unrecognized instruction
136: Bad CPU type
137: Overflow
138: Program exited with code 0 during signal handling
139: Segmentation violation during signal handling
140: User defined signal 1
141: User defined signal 2
142: User defined signal 3
143: User defined signal 4
144: User defined signal 5
145: User defined signal 6
146: User defined signal 7
147: User defined signal 8
148: User defined signal 9
149: User defined signal 10
150: User defined signal 11

/* In general, exit codes beyond 128 are used to indicate that a program terminated due to a signal. Here are some commonly used exit codes beyond 128:

130: Program terminated due to Ctrl+C interrupt (signal 2, SIGINT)
137: Program terminated due to SIGKILL signal (sent by the system when a process exceeds its resource limits, such as running out of memory)
139: Program terminated due to SIGSEGV signal (program tried to access an invalid memory location)
143: Program terminated due to SIGTERM signal (sent by the system when it wants the program to gracefully terminate) Note that some exit codes beyond 128 have specific meanings on certain operating systems, such as:

130: On some systems, 130 may indicate that a program was terminated due to a Ctrl+\ interrupt (signal 3, SIGQUIT)
143: On some systems, 143 may indicate that a program was terminated due to a SIGPIPE signal (usually sent when a program tries to write to a pipe that has no readers) */

144: Fatal error or received SIGABRT signal
145: Received SIGPIPE signal
146: Invalid lock file format
147: Invalid or incomplete multibyte or wide character
148: Illegal byte sequence
149: Cannot send after transport endpoint shutdown
150: Too many symbolic links encountered
151: Stale NFS file handle
152: Network file descriptor not available
153: No locks available
154: Function not implemented
155: Directory not empty 156: Too many levels of symbolic links

156>>>>>>>> unknown

/* exit codes are integers that range from 0 to 255. In shell scripting, exit codes from 0 to 125 are reserved by POSIX, while exit codes from 126 to 255 are reserved for special purposes by the shell or the operating system. Therefore, there are a total of 256 possible exit codes. */