kill: failed to parse argument %n

New to Debian (Or Linux in general)? Ask your questions here!

kill: failed to parse argument %n

Postby alete » 2018-05-29 15:37

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?
alete
 
Posts: 19
Joined: 2017-05-19 16:42

Re: kill: failed to parse argument %n

Postby debiman » 2018-05-31 17:47

you're supposed to use the pid.
also see
Code: Select all
man kill
User avatar
debiman
 
Posts: 2900
Joined: 2013-03-12 07:18

Re: kill: failed to parse argument %n

Postby alete » 2018-06-01 12:11

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
alete
 
Posts: 19
Joined: 2017-05-19 16:42

Re: kill: failed to parse argument %n

Postby kingocounty » 2018-06-01 12:35

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
kingocounty
 
Posts: 12
Joined: 2018-03-14 13:11

Re: kill: failed to parse argument %n

Postby debiman » 2018-06-02 11:33

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...
User avatar
debiman
 
Posts: 2900
Joined: 2013-03-12 07:18

Re: kill: failed to parse argument %n

Postby alete » 2018-06-26 14:35

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:~$
alete
 
Posts: 19
Joined: 2017-05-19 16:42

Re: kill: failed to parse argument %n

Postby bw123 » 2018-06-26 15:45

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
$
User avatar
bw123
 
Posts: 3399
Joined: 2011-05-09 06:02
Location: TN_USA

Re: kill: failed to parse argument %n

Postby alete » 2018-06-26 20:52

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!
alete
 
Posts: 19
Joined: 2017-05-19 16:42


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable