Questions tagged [pkill]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
3 answers
967 views

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) ...
user avatar
1 vote
1 answer
39 views

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 ...
user avatar
0 votes
0 answers
19 views

Unable to kill node process on RedHat Linux

This is my OS: [root@efendibey_live nginx]$ uname -a Linux efendibey_live 3.10.0-1160.6.1.el7.x86_64 #1 SMP Tue Nov 17 13:59:11 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux [root@efendibey_live nginx]$ ...
user avatar
  • 307
1 vote
1 answer
57 views

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 ...
user avatar
  • 423
-1 votes
2 answers
103 views

pkill in server ubuntu

I used the command pkill as root on my vps ubuntu, and I got kicked out of the server and can't access it. This is what I wrote inside the terminal: pkill h h is my user in ubuntu What is the ...
user avatar
  • 9
0 votes
1 answer
93 views

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, ...
user avatar
  • 583
4 votes
1 answer
2k views

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....
user avatar
0 votes
2 answers
83 views

Is there a way to trigger the closing of one program by closing another? A shell script perhaps?

So, my situation is this: I have created a launcher, key bindings and an alias that opens GLava and CMus in a drop-down terminal at the same time, using this shell script: #!/bin/bash c=$(ps -e | ...
user avatar
6 votes
3 answers
3k views

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 ...
user avatar
  • 768
4 votes
0 answers
484 views

How do I send signal to all processes in a cgroup?

kill $(< /sys/fs/cgroup/freezer/<name>/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 ...
user avatar
  • 5,176
1 vote
1 answer
230 views

Why does pkill not work with rofi?

I want to toggle rofi an application launcher with one keybinding. I made a shell script, #!/bin/bash rofi -dpi 1 -modi drun -show drun -show-icons And bound it to some key. This works but to toggle ...
user avatar
  • 113
0 votes
1 answer
2k views

How to kill the PID of service that configured as Restart=always

Dear friends and colleges , We have service under /etc/systemd/system Service name is calc_live_servers.service Since Restart=always is configured in calc_live_servers.service Then when we kill ...
user avatar
0 votes
1 answer
135 views

How to forcefully close a ssh connection is the command on the target server never returns

I have an automation tool that generates and executes the below command that fires rpm -qa grep httpd on the target host 10.9.100.67. ssh -vvv -o StrictHostKeyChecking=no -o 'IdentityFile="/app/...
user avatar
  • 307
0 votes
0 answers
251 views

How to get cron to pkill my java process?

I have a cron job that runs to detect if a certain application has frozen. If so it should kill the frozen application and restart it. The application is a Java program. When the application is frozen,...
user avatar
2 votes
2 answers
875 views

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 ...
user avatar
1 vote
1 answer
256 views

Why pkill return -9?

I want to run command pkill -9 -f 'java.*7104' in python3 use subprocess.run, but I do not know why returncode=-9, can anyone explain this? >>> subprocess.run("pkill -9 -f 'java.*7104'", ...
user avatar
  • 223
2 votes
1 answer
1k views

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 ...
user avatar
0 votes
0 answers
22 views

Digital ocean server access issue

I have accidentally run command pkill -U root. I was in root user.. now I am not able to access through ssh from my local system but I can access my server's terminal on my browser from my digitl ...
user avatar
  • 101
1 vote
1 answer
357 views

Tagging a process so I can kill it later easily by identifying

I need to tag a generic process (I don't really control the command being run). Could I do something like this: run_special_cmd(){ "$@" -- --very-special-command } run_special_cmd sleep 5000 &...
user avatar
1 vote
1 answer
3k views

pkill does not work on Ubuntu 16.04

I list all the processes in the system using ps -aux and I found this java process: 10253 2.1 10.1 3259172 398864 pts/0 Tl 06:58 0:09 java -jar /opt/can-peris/core-price-update/menu-core-...
user avatar
  • 331
1 vote
1 answer
803 views

MacOS: su pkill -9 “process_name” = sorry

How to use pkill as su on a Mac? When I run su pkill -9 "RFBEventHelperd" in the terminal I get su: Sorry (but works as sudo). I am looking for a way to kill this process from inside a script that ...
user avatar
  • 27
0 votes
3 answers
1k views

pkill -P variable not working when running .sh under cron

I have a very simple .sh script to kill a process. The processes saves its PID to pid2.txt. pkill -e -P $(cat pid2.txt) exit When I run this as sudo ./myscript.sh from the command line it works fine....
user avatar
  • 434
0 votes
2 answers
1k views

Using `pgrep` to emulate `ps -ef` for use in a `for i in` loop

Ubuntu 16.04 I am used to using this command line to kill any process match said COMMAND for i in $(ps -ef | grep COMMAND | awk '{ print $2 }'); do kill -9 "$i" &>/dev/null;done shellcheck ...
user avatar
6 votes
4 answers
5k views

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 "...
user avatar
0 votes
1 answer
2k views

What is the `-KILL` option in `pkill` command

I have found a way to logout any user by using the command line. By executing the command pkill -KILL -u <username>, I can now log myself out from the session I have entered. My question is ...
user avatar
  • 469
1 vote
1 answer
46 views

Process is running [closed]

I have run the following command as root today morning sh /home/suio/LoadSnortSingature.sh > /home/suio/logs.txt 2>&1 after some time the session of the terminal closed and I have relogged in ...
user avatar
  • 191
1 vote
1 answer
13k views

How to force a PID to terminate? [duplicate]

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 ...
user avatar
  • 1,122
7 votes
1 answer
39k views

How to kill all processes owned by `user` on Centos 7? [duplicate]

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: ...
user avatar
  • 2,566
3 votes
2 answers
2k views

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 ...
user avatar