Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

kill: failed to parse argument %n

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
alete
Posts: 19
Joined: 2017-05-19 16:42

kill: failed to parse argument %n

#1 Post by alete »

Hello, everybody.
I'm running a clean Debian 9 on my laptop and I'm being unable to kill a proccess giving it's job number:

Code: Select all

alete@debian:~$ vi &
[1] 14760
alete@debian:~$ jobs
[1]+  Stopped                 vi
alete@debian:~$ sudo kill %1
kill: failed to parse argument: '%1'
alete@debian:~$ 
wasn't it supposed to work this way?

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: kill: failed to parse argument %n

#2 Post by debiman »

you're supposed to use the pid.
also see

Code: Select all

man kill

alete
Posts: 19
Joined: 2017-05-19 16:42

Re: kill: failed to parse argument %n

#3 Post by alete »

debiman wrote:you're supposed to use the pid.
also see

Code: Select all

man kill
%1 indicates a job, it should return the pid https://superuser.com/a/317155/627973

User avatar
kingocounty
Posts: 12
Joined: 2018-03-14 13:11

Re: kill: failed to parse argument %n

#4 Post by kingocounty »

Bash has a built-in kill function that takes precedence over the external kill command, and it does support jobspecs.

Typing

Code: Select all

help kill
will show you the details.

Try your command again without 'sudo'.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: kill: failed to parse argument %n

#5 Post by debiman »

kingocounty wrote:Try your command again without 'sudo'.
i remembered this a second after i pressed reply, but was too lazy to go back and edit...

alete
Posts: 19
Joined: 2017-05-19 16:42

Re: kill: failed to parse argument %n

#6 Post by alete »

kingocounty wrote:Bash has a built-in kill function that takes precedence over the external kill command, and it does support jobspecs.

Typing

Code: Select all

help kill
will show you the details.

Try your command again without 'sudo'.
nothing happens without sudo

Code: Select all

alete@debian:~$ jobs
[1]+  Stopped                 top
alete@debian:~$ kill %1

[1]+  Stopped                 top
jobse@debian:~$ 
jobs
[1]+  Stopped                 top
alete@debian:~$ 

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: kill: failed to parse argument %n

#7 Post by bw123 »

works here on xterm, after hitting enter twice, as mentioned in this nice turtorial...
https://www.digitalocean.com/community/ ... -processes
...
Depending on how your terminal is configured, either immediately or the next time you hit ENTER, you will see the job termination status:
...

Code: Select all

$ nano &
[1] 716
$ jobs
[1]+  Stopped                 nano
$ kill %1
$ 
[1]+  Terminated              nano
$
resigned by AI ChatGPT

alete
Posts: 19
Joined: 2017-05-19 16:42

Re: kill: failed to parse argument %n

#8 Post by alete »

bw123 wrote:works here on xterm, after hitting enter twice, as mentioned in this nice turtorial...
https://www.digitalocean.com/community/ ... -processes
...
Depending on how your terminal is configured, either immediately or the next time you hit ENTER, you will see the job termination status:
...

Code: Select all

$ nano &
[1] 716
$ jobs
[1]+  Stopped                 nano
$ kill %1
$ 
[1]+  Terminated              nano
$
and that, my friend... it's what I call a "good call". Not that I understand why, but it worked. Thanks!

Post Reply