I'm using Red Hat 6, and typing jobs gives me:

[2] + 12511
      12510      Running                 find . | xargs grep -i "string" >../a.txt

Those pids don't exist, and typing fg %2 outputs:

find . | xargs grep -i "string" >../a.txt

I normally have no problems starting jobs, pushing them in the background, bringing them back into the foreground etc. This has happened before, though. I don't see the entries when I create another session. Is there a command I can run to refresh whatever state is being confused here? Is this an indication of a bigger problem? I'm using ksh.

  • 1
    The output of jobs matches what it brings back in the foreground with fg, so I don't see what your real problem is. Doesn't ps -ef|grep find show that find process? If not, perhaps that part is done and it's still greping for your string in that huge directory listing. ps -ef|grep grep would show it. – Julie Pelletier Jan 13 '17 at 17:13
  • My real problem is just as described; jobs showing long dead processes. Find isn't running. Both your ps|grep commands just show up the grep they invoke. My user only has 5 processes showing under ps; 2 ssh related, ksh and the ps/grep i'm using to display them. – user13757 Jan 13 '17 at 17:18
  • Hmmm. How about ps -ef|grep "string" where string is the initial search string you used, or ps -ef|grep xargs to see if it's stuck on xargs? – Julie Pelletier Jan 13 '17 at 17:21
  • What version of ksh? Post the content of your .kshrc. Can you reproduce the problem reliably, or is it intermittent? If it happens in a shell, does it keep happening in the same shell for the same command? for all commands? – Gilles Jan 14 '17 at 15:28
  • not stuck on xargs; no sign of the original string. Can't reproduce the problem on demand; it's happened only 2 or 3 times ever. Don't think I have a .kshrc. – user13757 Jan 16 '17 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy