Reputation: 2233
I am trying this out in termnial:
/tmp ps x | grep -m1 firefox | cut -d' ' -f1 | kill -KILL
kill: not enough arguments
How can I pipe the pid to kill?
I tried this, didn't work
/tmp ps x | grep -m1 firefox | kill -KILL $(cut -d' ' -f1)
cut: -: Input/output error
kill: not enough arguments
Upvotes: 1
Views: 5869
Reputation: 111239
You can use xargs. This reads the output of command1 and use it as the arguments to run command2:
command1 | xargs command2
In your case
ps x | grep -m1 firefox | cut -d' ' -f1 | xargs kill -KILL
Upvotes: 2