29 votes
Accepted

Killing systemd service with and without systemctl

First, your systemctl syntax is wrong: systemctl kill expects a unit name, not a PID, and -s requires a signal name. As written, it won't do anything but give you an error message: Failed to parse ...
Michael Hampton's user avatar
9 votes
Accepted

cannot remove file, Device or resource busy

Its still mounted. I bet you see it if you run mount. If so run the following # umount /var/lib/docker/aufs # rm -rf /var/lib/docker
Mike's user avatar
  • 22.5k
6 votes

Find (and kill) old processes

killall --quiet --older-than 1w process_name
billyw's user avatar
  • 1,612
4 votes

How do I kill processes older than "t"?

The problem Converting etime (elapsed time) column of ps command to seconds. The time specification is in this format [[dd-]hh:]mm:ss. Newer versions of ps have an etimes column which outputs etime ...
Vlastimil Ovčáčík's user avatar
4 votes

How do I kill processes older than "t"?

apt-get install psmisc killall -o 1h $proc_name
Alex's user avatar
  • 51
4 votes

Cannot kill VMware VM

After having identified the right process using ps | grep vmx, you can abruptly terminate it via kill -9 <pid> Be very careful to select (and kill) the right process. For more information, ...
shodanshok's user avatar
  • 50.5k
3 votes
Accepted

Is it safe to stop a Jboss EAP server with Kill -9?

If the software is non-trivial and comes with a documented means of shutting it down, as appears to be the case here, go with whatever that is. (There may be multiple options.) Regarding SIGKILL (...
Håkan Lindqvist's user avatar
3 votes

Cannot kill VMware VM

How can I identify the root cause for this very strange behaviour? Scientific method is your friend. Define the problem you want to solve. It looks like you have 2 (possibly interrelated) issues. ...
user9517's user avatar
  • 116k
2 votes

kill a screen (but not all screens)

If you have several screens with the same name, you can kill them at once: screen -ls | egrep "^\s*[0-9]+.ScreenName" | awk -F "." '{print $1}' | xargs kill Command screen -ls prints screens with ...
محسن عباسی's user avatar
2 votes
Accepted

Ubuntu server randomly kills Apache2 - I guess I know why

See man update-alternatives for a description of the alternatives system This is the command being run on your system update-alternatives --install /usr/bin/php php /usr/bin/php5 50 --slave /usr/...
Ryan Babchishin's user avatar
2 votes

Kill defunct xrdp session --- xrdp users cannot log on

xrdp is making a log diary about the session inside .xrdp* files stored into the user's home directory. It might happen some .xrdp* session files to be stored into /tmp/ or /tmp/.xrdp/. xrdp service ...
miki's user avatar
  • 21
2 votes

Is it safe to stop a Jboss EAP server with Kill -9?

Just assume every gun is loaded and every application is signal 9 unsafe. Assuming otherwise you would very likely waste a huge amount of time in debugging occasional malfunctions, caused by things as ...
anx's user avatar
  • 9,738
2 votes

How to kill a process by its full name, including the path?

If your script can be shown by its full name including the path using ps, you can easily do that: MYPID=$( ps faux | grep '/tmp/test.sh' | grep -vw grep | awk '{ print $2 }' ); echo ${MYPID}; kill -9 ...
Craft's user avatar
  • 171
1 vote
Accepted

Permission denied when using kill as root

Check if you have Apparmor enabled, it can block your attempts to kill that process as non-owner.
Dima Shcherbakov's user avatar
1 vote
Accepted

virt-install hangs and won't die. How to stop safely?

In my experience if something hangs that hard that plain kill is ignored, there isn't any friendly way to exit the hung applications. Maybe kill -9 will help, but if host reboot also hangs with ...
Cole Robinson's user avatar
1 vote

Kill a running process inside a docker

when you build Docker, use this command : RUN apt-get install lsof then in py file you can use: os.system("lsof /dev/nvidia* | awk '{print $2}' | xargs -I {} kill {}") REMEMBER: this ...
Ali Ganjbakhsh's user avatar
1 vote
Accepted

How to restart linux services if it reaches 100% CPU?

You might want to take a look at monit (official site). It's easily configurable to watch for high CPU usage and restart processes when needed. A simple example (you should configure it according ...
Daniele Santi's user avatar
1 vote

ssh remote command: Killed by signal 15

I think what's happening here is that the pgrep -f "/usr/bin/nmon" is also matching the shell running that command, since it will find the string "/usr/bin/nmon" in the full command-line and you ...
filbranden's user avatar
1 vote

Is it safe to stop a Jboss EAP server with Kill -9?

According to official RedHat doc, signals SIGHUP, SIGINT and SIGTERM trigger gracefull shutdown. SIGKILL (kill -9) does not.
yntelectual's user avatar
1 vote

How to make a shell script return 0 even after getting killed

Depends on the signal. Bash allows you to trap with the trap command, but if your script is being killed with SIGKILL (9), it is uninterruptible and untrappable.
brent's user avatar
  • 3,521
1 vote

how to stop for loop on another tty

You could try to use pstree to find shell where for executed. For example, I run loop with command for i in {1..1000}; do sleep 5; done, then I do pstree -p | grep sleep, see output | -sshd(29695)--...
Alexander Tolkachev's user avatar
1 vote
Accepted

Killing process group safely

The parent has to explicitly wait() for its children if it cares about their termination state. By default orphaned children are transferred to init (pid1) and not terminated. Unfortunately, when they ...
Andrew Domaszek's user avatar
1 vote

Kill defunct xrdp session --- xrdp users cannot log on

FOr anyone that comes across this issue, I found that xrdp server stores some state information about disconnected sessions. Even parsing all the TCP connections and killing the listening but not ...
asdgsd's user avatar
  • 11
1 vote
Accepted

Long running PHP process randomly stops with message 'Killed'

Looks like the culprit was OOM-KILLER due to no-swap-left, evidence was left in /var/log/messages Apr 17 05:29:31 Centos-PHP56 kernel: php invoked oom-killer: gfp_mask=0x280da, order=0, oom_adj=0, ...
Jeffrey L. Roberts's user avatar
1 vote

Kill a process and force it to return 0 in Linux?

To make sure the kill or killall command doesn't break the shell (like in a bash script with set -e), or make sure the line with kill exits with 0. We may try killall <PROCESS_NAME> || /bin/true ...
socrates's user avatar
  • 111
1 vote

VPS yum update filesystem ... killed

Create a Linux Swap File temporarily , 1GB is enough for "yum update -y" https://linuxize.com/post/create-a-linux-swap-file/
Netu Netov's user avatar
1 vote

Find (and kill) old processes

If you have a Python/Perl/Ruby script you want to kill, killall won't help you since killall will just look for "python" or "perl", it can't match the name of a specific script. To kill all processes ...
Earl Ruby's user avatar
  • 429

Only top scored, non community-wiki answers of a minimum length are eligible