Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an exercise to put in a file some data (*conf from some directories) and need to do this in background. I did it and I am wondering what is the meaning of output messages:

[A@localhost tests]$ ls -ld /etc/*conf /usr/*conf > test1_6_conf.txt 2>&1 &

Enter rises this row:

[1] 2533

what does it mean? After other Enter, another messages appear

[A@localhost tests]$
[1]+  Exit 2                  ls --color=auto -ld /etc/*conf /usr/*conf > test1_6_conf.txt 2>&1

What does it mean? What is "Exit 2"?

Enter an check results - seems to be all OK.

[A@localhost tests]$
[A@localhost tests]$ ls -l test1_6_conf.txt
-rw-rw-r--. 1 A A 2641 Nov 22 14:19 test1_6_conf.txt
[A@localhost tests]$ 

I am using CentOS 6.4, Gnome Terminal Emulator.

share|improve this question
up vote 5 down vote accepted

What does it mean? What is "Exit 2"?

It is exit status of ls. See man for ls:

   Exit status:
       0      if OK,

       1      if minor problems (e.g., cannot access subdirectory),

       2      if serious trouble (e.g., cannot access command-line argument).

I guess the reason is that you have lots of *conf files in /etc and no *conf files in /usr. In fact ls -ld /usr/*conf; would have had the same effect.

So If I do on my computer ls for an existing file:

ls main.cpp; echo $?

And for a file that does not exists:

ls main.cppp; echo $?
ls: cannot access main.cppp: No such file or directory

Or as a background process ls for a a file that does not exists:

>ls main.cppp &
[1] 26880
ls: cannot access main.cppp: No such file or directory
[1]+  Exit 2                  ls main.cppp
share|improve this answer
O! Thanks. Now I've realized that ls /usr/*conf return 2 since there no any filenames containing "conf". – ALZ Nov 22 '13 at 12:59
@ALZ, note that it returns 2 because it cannot find the file called /usr/*conf. And bash is passing it that filename because it can't find files that match that pattern. Better shells like zsh would have returned a "no match" error and not run ls at all. – Stéphane Chazelas Nov 22 '13 at 13:59

That mean command has finished with exit status different than 0 (success).

Try to not put (&) at the end, to see what happen.

If that command take a lot when running, you could check it with:

lnx#> jobs -l

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.