Questions tagged [pkill]
31 questions
8
votes
1 answer
How to kill all processes owned by `user` on Centos 7?
I read in an online flash card that the command is:
pkill -u bob $(pgrep -u bob)
However, I think this is wrong. I think it's saying:
Kill all the processed owned by bob, and 4572\n4600
Because:
[bob@localhost ~]$ pgrep -u bob
4572
4600
Also, it…
mbigras
- 2,928
- 6
- 28
- 45
6
votes
4 answers
Is there a clean way to `sudo pkill` processes without including the `sudo` process?
I need to kill some processes that are run as sudo, matching them by full name, and count the number of original command invocations.
For each process there are two processes: the command itself, and the sudo one, but I can work this around:
$ sudo…
Marcus
- 869
- 2
- 8
- 22
6
votes
4 answers
How to stop a script within another script
I'm running Ubuntu 16.04, using a terminal emulator.
I have two scripts: a.sh and b.sh.
a.sh calls b.sh.
a.sh
echo "a is running"
sleep 5s
bash b.sh
sleep 5s
echo "a is still running"
b.sh
echo "b is now running"
sleep 1000s
echo "Bananas"
Is…
speld_rwong
- 799
- 1
- 12
- 21
4
votes
3 answers
Why are the signal lists for kill, killall and pkill not the same?
I researched the kill, pkill and killall commands, and I understood most of their differences. However, I am confused about their signals:
If I run kill -l, I see:
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6)…
Manuel Jordan
- 1,414
- 9
- 33
4
votes
1 answer
Delete / Kill a process which won't die
I'm using Linux Ubuntu 20.04.
I have a process with PID 21:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kdevtmpfs
After running either of
sudo pkill…
Dean Van Greunen
- 147
- 1
- 7
4
votes
0 answers
How do I send signal to all processes in a cgroup?
kill $(< /sys/fs/cgroup/freezer//tasks ) works, but looks clumsy, produces a warning if cgroup is empty and may hit command line length limit.
pkill -F does not accept cgroup tasks file as a valid pidfile.
There seems to be no dedicated tool…
Vi.
- 5,528
- 7
- 34
- 68
4
votes
2 answers
Kill process by name
I am using bash to start several instances of one python program, like this:
python example.py -id $i
where $i is the id given to the instance. All the processes are started on the same user, and imagine I am unable of keeping track of the process…
Jeroen Smulders
- 41
- 2
3
votes
1 answer
Execute multiple commands in one line through ssh starting with pkill -f
Noticed something strange while working with a raspberry pi.
Using pkill with no options allows me to run other commands afterwards in the same line, but if I use the option -f, then subsequent commands are ignored. Does anyone know why?
$ ssh…
Marcelo
- 31
- 2
3
votes
2 answers
would like to suppress the output of pkill on a background process
I have a shell-script in which I do an
iostat -c 1 > data.cpu. &
Later in the script, after I've collected the data I'm interested in, I do a
pkill iostat
which kills iostat and allows me to continue by processing data.cpu and generating a…
Richard Gostanian
- 345
- 1
- 8
3
votes
1 answer
How to force a PID to terminate?
Yes, I've tried all the basic kill, pkill, etc. methods that come up with a Google search.
Sometimes it works, other times it seems something is preventing the process from terminating.
There is no stderr message when the kill command fails, but ps,…
voices
- 1,252
- 3
- 15
- 30
2
votes
1 answer
How to get pkill to output process information of killed process?
How to get pkill to output process information of killed process?
I don't see anything in man pkill that suggests this is possible. I know I can do a pgrep and process the list and then pipe that to kill but hoping this is in native pkill. I also…
Elijah Lynn
- 965
- 1
- 11
- 19
1
vote
1 answer
Linux using pkill to kill by process name for a specific user
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…
kasssia
- 13
- 2
1
vote
1 answer
What does Session ID mean within the pkill context?
About the pkill command, I know is possible kill processes - for specific scenarios - based through tty[1-6] and pts/[0-N]. I tested and works as expected. Until here all is ok.
But now, according with this answer and solution:
What is the…
Manuel Jordan
- 1,414
- 9
- 33
1
vote
1 answer
When to use "pkill..." flag in newsyslog.conf?
I'm configuring relayd to log to its own log, and I'm not clear on whether I should run "pkill...".
I can see the following in the default newsyslog.conf:
# logfile_name owner:group mode count size when flags
/var/log/maillog …
Paul
- 497
- 6
- 21
1
vote
1 answer
How to kill chrome under Linux so that it'll resume next time
How to kill chrome under Linux so that it'll resume/restore the sessions when it is started next time?
It's a trivial thing to do under Windows, but under Linux, no matter how I tried to kill chrome, on next start, it forgets all the old sessions as…
xpt
- 1,182
- 2
- 13
- 32