Linux using pkill to kill by process name for a specific user
2
votes
1
answer
3161
views
I have a bash script where I run the pkill command to kill running processes. I have the username param defined as follows:
username=$(whoami)
I want to be able to kill processes based on the process name but also kill them only for the current user.This script will be used by other users as well, hence setting the username param so that the script works for them also.
Can any one tell me how I would go about that?
Im trying the following:
pkill -f -U $username | "testProcess"
is this the correct approach?
Asked by kasssia
(23 rep)
Nov 22, 2022, 10:36 AM
Last activity: Nov 22, 2022, 10:51 AM
Last activity: Nov 22, 2022, 10:51 AM