1

I'm running few tasks side by side on an ubuntu 18 LTS. So I'm switching between these jobs by running

# command &
# fg
# fg -

(Also) use of Ctrl+z sometimes to send running job to background.

Say I have 3 jobs in my list

# jobs
[1]+  Stopped                 nano /etc/nginx/site-available/blog.conf
[2]   Stopped                 top
[3]-  Stopped                 nano script.sh

I can successfully switch between these, but when I run kill command on these, jobs still showing in the list, none gets killed, I wonder why?

# kill %1

I list again, and jobs are still there.

# jobs
[1]+  Stopped                 nano /etc/nginx/site-available/blog.conf
[2]   Stopped                 top
[3]-  Stopped                 nano script.sh
AdminBee
  • 22,803
Sollosa
  • 1,929
  • 4
  • 20
  • 38
  • @Stephen Kitt @AdminBee the question is particularly about this: kill %1 not working. I can kill process with process id, but why not like this? – Sollosa Mar 11 '20 at 09:35
  • I believe it is related, but not dupe. – peterh Mar 11 '20 at 11:18
  • Re-opened. Does this apply to all your stopped jobs? – Stephen Kitt Mar 11 '20 at 12:32
  • What shell are you running and does it make a difference if you use another shell? – Kusalananda Mar 11 '20 at 12:35
  • 1
    The kill is remembered, but they might have a signal handler installed. They need to be allowed to run, even if the signal immediately terminates them. fg them and they will exit. – Paul_Pedant Mar 11 '20 at 14:03
  • @Stephen Kitt Ok while this question was locked here, I got it posted on askubuntu forum, and got answer too. You can link these if you want as duplicates now. Here's link to that question. https://askubuntu.com/questions/1216309/why-does-kill-jobnumber-not-work-on-stopped-jobs/1216319#1216319 – Sollosa Mar 12 '20 at 06:26
  • 1
    OK, so based on the answer to your AU question, the difference isn’t kill %1 v. kill PID, and my original duplicate was correct. – Stephen Kitt Mar 12 '20 at 07:54

0 Answers0