kill processes shown by sudo fuser filtered by COMMAND column
3
votes
1
answer
6302
views
using the following line I have been able to see processes that use the GPU some of which are mentioned python under the COMMAND column.
sudo fuser -v /dev/nvidia*
which prints:
USER PID ACCESS COMMAND
/dev/nvidia0: root 1197 F...m Xorg
alireza 1451 F...m gnome-shell
alireza 5527 F...m python
alireza 5567 F.... python
alireza 5568 F.... python
how can I kill all the processes which are mentiond python in the COMMAND collumn. But so far i have to do it manually by for each PID by
sudo kill -9
which is not easy if there are many of them.
is there a way to automate this and make it faster? like writing only one command and kill all the PIDs that has pyton in the COMMAND column?
Asked by Alejandro
(133 rep)
Jul 31, 2020, 10:05 AM
Last activity: Jul 31, 2020, 01:18 PM
Last activity: Jul 31, 2020, 01:18 PM