40

What is meaning of exit status 1 returned by linux command? Like 127 exit status indicates "command not found".

I have visited http://linux.die.net/abs-guide/exitcodes.html page, does it mean exit status 1 does not have particular special meaning?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user2664054
  • 541
  • 1
  • 5
  • 9
  • 1
    The ABS link is confused. These exit codes are not "reserved" and the table is a happy drunk mixture of Bash-internal usage, general Unix conventions, and the author's loud opinion. – tripleee Jan 07 '14 at 07:45
  • See also now http://stackoverflow.com/questions/36530696/linux-how-to-get-error-description-by-error-number/36566055#36566055 – tripleee Apr 12 '16 at 07:34

3 Answers3

45

The only general convention is that a zero exit status signifies success, whereas any non-zero exit status is a failure.

Many -- but certainly not all -- command-line tools return exit code 1 for syntax error, i.e. you had too few arguments or an invalid option.

Many -- but, alas, not all -- command-line tools have a manual page. By convention, it should document the exit codes of the program, but many do not.

tripleee
  • 175,061
  • 34
  • 275
  • 318
18

You can see the value of the exit status using man.

Giving an example below:

man ls

Now search for string exit

Adding screen shot below:

enter image description here

Noumenon
  • 5,099
  • 4
  • 53
  • 73
Tajinder
  • 2,248
  • 4
  • 33
  • 54
  • As tripleee posted not all command's man page documented exit codes. I am facing exit status related problem for command msgfmt, it's man page does not documented about exit codes. – user2664054 Jan 07 '14 at 11:11
  • [msgfmt.c](http://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/src/msgfmt.c) seems to use the generic [EXIT_FAILURE](https://www.gnu.org/software/libc/manual/html_node/Exit-Status.html) in basically every error situation. There would be an error message telling you what went wrong, though. – tripleee Nov 01 '15 at 09:51
0

Exit Code 1 means that a container terminated, typically due to an application error or an invalid reference. A non-zero (1-255) exit status indicates failure.

For example, if a Java library is running , and the library throws a compiler error, the container might terminate with Exit Code 1.

A command which exits with a zero (0) exit status means it succeeded.

Du-Lacoste
  • 11,530
  • 2
  • 71
  • 51