kill - Send a specified signal to a process or process group.

learn more… | top users | synonyms

35
votes
6answers
4k views

Does pressing ctrl-c several times make the running program close more quickly?

I often start to read a huge file and then want to quit after a while, but there is a lag from pressing Ctrl+C to the program stops. Is there a chance of shortening the lag by pressing the Ctrl+C key ...
3
votes
1answer
266 views

How does the piping in this command ultimately achieve to kill the process?

I have seen the following line in a bash script for killing a process(in this case started with the command loadgen): ps xww | grep -i "loadgen" | grep "PATTERNMATCH_FACT.xml" | cut -c1-5 | xargs -i ...
0
votes
2answers
276 views

What does this logrotate nginx config do?

In my /etc/logrotate.d/nginx I saw, /var/log/nginx/*.log { daily missingok rotate 52 compress delaycompress notifempty create 640 nginx adm ...
8
votes
2answers
313 views

How can I create a hard to kill process

I want to create a program that will be difficult to stop (even for the administrator) once it is started (with root privileges). Once started the process should continue to start itself at startup ...
14
votes
4answers
22k views

How to stop a background process?

I have started a wget on remote machine in background using &. Suddenly it stops downloading. I want to stop its process, then start it again. How can I stop it? I haven't close its shell window. ...
1
vote
4answers
2k views

Why teamviewer starts again after being killed

My main desktop has Mint 14 and I approached it via SSH from another computer, because I didn't have a screen on the Mint one. Then I tried to start teamviewer just I order to launch its desktop ...
1
vote
4answers
65 views

how to close the jobs one by one? is there any options?

There is list of jobs running. pdf is opened image is opened text file opened It's all in fg/bg . Is there any option to close the particular job forcefully? Also, I want to know if the jobs can ...
5
votes
2answers
2k views

Kill process spawned by ssh when ssh dies

This is a question that has been addressed several times, not only here, but also in other sites of the stack exchange network (e.g. ...
5
votes
3answers
556 views

Using `kill -s 0 $pid` vs `[[ -e /proc/$pid ]]` to detect if PID is running

One of the idioms often used to check if process is running is to use kill -s 0 $pid. My question is, does it have any upsides over using [[ -e /proc/$pid ]] construct? The script I'm writing is ...
1
vote
2answers
78 views

"trap 'killall $$ ; rm -f $folder2;exit ' 18 20 24

What is wrong with this command? $ trap 'killall $$ ; rm -f $folder2;exit ' 18 20 24 That command is in a for loop, and while that for is executing, if I press CTRL-Z I want it to stop the process ...
1
vote
2answers
291 views

xargs inside a for loop

So we got most of it figured out but here's what happens. for i in $(arp |sort |awk '{print $1}'|grep IPADDRESS) do ssh USERNAME@$i "ps -ef |grep X11|grep -v grep |awk '{print $2}'|xargs kill" done ...
12
votes
3answers
5k views

Default exit code when process is terminated?

When a process is killed with a handle-able signal like SIGINT or SIGTERM but it does not handle the signal, what will be the exit code of the process? What about for unhandle-able signals like ...
0
votes
2answers
267 views

Kill a nohup mpi process

I have started a program in parallel using the command: nohup mpirun -7 mylongprogram.py & I now want to terminate the program. When I want to kill the process by the command: kill -9 ...
2
votes
0answers
36 views

Reason for the inability of root to send a fatal signal to PID 1/init [duplicate]

Why can't root send a fatal signal to PID 1/init process (sudo kill -9 1)? As stated here.
2
votes
2answers
4k views

How do I kill all screens?

I accidentally created over 1000 screens. How do I kill them all with one command? (Or a few)
1
vote
3answers
4k views

process id and killing process - ps commmand

Please see the output of below ps command: abc@smaug:~/Desktop$ ps ax | grep firefox 2213 ? Sl 2:01 /usr/lib/firefox/firefox 2644 pts/0 S+ 0:00 grep --color=auto firefox Please ...
1
vote
1answer
331 views

Script ends abruptly with a Terminated message

This is my bash script. All it does is to check whether a service has started and whether some processes are running as expected. It ends abruptly with a Terminated message. I tried debugging it ...
1
vote
1answer
337 views

How to create alias to kill processes running on a TCP/IP port? [duplicate]

What I have: alias killport='sudo kill -9 `sudo fuser -n tcp $1 2> /dev/null`' Problem: Running e.g. killport 8000 doesn't appear to work, though. However, simply running... sudo kill -9 `sudo ...
0
votes
2answers
335 views

Pass flags to xargs

I want to kill a bunch of processes using this command: sudo ps ax | grep node | awk '{print $1}' | xargs kill But it gives me operation not permitted even with sudo. Then I tried with kill -9 ...
2
votes
0answers
121 views

cabal dies on NixOS in KVM

I set up a NixOS system on KVM and installed the haskelPlatform package. Everything works fine, ghci works fine, but cabal dies without any helpful error message: [michas@nix:~]$ type -a cabal cabal ...
11
votes
2answers
1k views

Does `kill -p` really work?

In the man page of kill it is written as following SYNOPSIS kill [ -s signal | -p ] [ -a ] [ -- ] pid ... kill -l [ signal ] -p Specify that kill should only print the process id ...
8
votes
3answers
2k views

What's the difference between pkill and killall?

I know that pkill has more filtering rules than killall. My question is, what is the difference between: pkill [signal] name and killall [signal] name I've read that killall is more effective ...
1
vote
2answers
1k views

How can I automatically kill the process with the highest CPU load?

Sometimes programs will lock up in the background and cause high CPU usage. Is there any way I can programmatically ascertain which process is causing the highest CPU load at the moment and kill it?
0
votes
2answers
6k views

How to kill a process that says “Operation not permitted” when attempted?

I have a process I would like to kill: computer@ubuntu:~$ ps aux | grep socat root 2092 0.0 0.0 5564 1528 pts/1 T 14:37 0:00 sudo socat TCP:xxx.17.29.152:54321 ...
2
votes
3answers
501 views

Rotating logs generated from tcpdump with logrotate

On one production linux box, I am capturing SIP packets using the following configuration: logrotate.conf: # Opensips SIP traces /var/log/sip.log { rotate 31 daily missingok ...
1
vote
1answer
103 views

How to list killable tasks?

As manpage of ps states A process with STATUS with the value "D" means "uninterruptible sleep (usually IO)" Also, I've read: You should use TASK_INTERRUPTIBLE here, otherwise your kernel thread ...
2
votes
5answers
977 views

Get return value of process by PID

If I have the PID of a process that was killed, how might I get the return status of the process? I am particularly interested to know if the return status was 143 (kill) or 137 (kill -9) as I don't ...
2
votes
1answer
209 views

kill all process of executables in a folder

I need to kill all the child process. The main process in lmbench pkill -9 lmbench is not killing it, but kill -9 <pid> kills the parent process, but even after killing the parent ...
1
vote
2answers
322 views

How to kill a script which starts new processes?

The following is a Python application which spans a few threads, then spawns a new process of itself and exits: $ cat restart.py import os import random import signal import sys import threading ...
4
votes
1answer
110 views

Stop a task based on output

I have a task that runs written in Mono, however sometimes (randomly) the Mono runtime will hang after the task is complete and just print: _wapi_handle_ref: Attempting to ref unused handle 0x2828 ...
3
votes
3answers
462 views

timeout without killing process in bash

I have a main script that I'm running, and from it I have a second "slow process" I want to kick off, and "do something" in the main script if it doesn't complete in the time limit -- depending on if ...
0
votes
1answer
113 views

pkill process containing special characters

trying to run pkill on file with "+" in the name pkill -SIGTERM -f "auth+live+ec575698789349860987088t897906769878968970" if i take out this part "auth+live+" I am successful I've tried putting it ...
4
votes
1answer
129 views

how to list all instances of an application?

How do I list all instances of an application. ie I am running 12 instances of application called "tcpA" I would like to list all of them. Below is top, I don't know if there is a way to look at a ...
2
votes
4answers
5k views

How to kill a process which can't be killed without rebooting?

There are 5 processes which can't be killed by kill -9 $PID and executing cat /proc/$PID/cmdline will hang the current session. Maybe they're zombie processes. Executing ps -ef or htop will also hang ...
5
votes
2answers
511 views

My process was killed but I cannot understand the kernel notice

I have a custom application running on an embedded x86 setup (built using buildroot and uClibc). The application has been running fine but this morning when I returned to work I discovered my process ...
8
votes
2answers
471 views

How signals work internally?

In general, to kill processes we generate signals like SIGKILL,SIGTSTP etc. But how is it known who ordered that particular signal, who has sent it to a particular process, and in general how do ...
4
votes
3answers
7k views

Terminating a bash shell script running in the background

I often use bash shell scripts to run simple commands for many different files. For example, suppose that I have the following bash shell script, called script.sh, that runs the program/command foo ...
3
votes
2answers
973 views

Closing all Nautilus windows from terminal

How can I close all opened Nautilus (explorer) windows from the terminal?
1
vote
2answers
680 views

How do I kill 'repo sync' using crontab given it spawns many processes?

I need to 'repo sync' the Android source overnight, as my monthly bandwidth is limited. , I start the 'repo sync' at midnight, then want to kill it at 8am. The following is the command: 2 0 * * * ...
1
vote
1answer
213 views

How to kill all processes that don't have specific parent process?

A parent process should always be running with N children process. I would like to run a script which will show/kill all children processes that don't have a parent process. $ ps faux | grep ...
0
votes
2answers
1k views

`ps | grep | kill` aborts my script prematurely [duplicate]

I have a Linux computer that I remotely SSH into using plink on a Windows XP machine. I have the Plink program set to execute commands in a script using automated login: plink -ssh [domain name] -l ...
3
votes
3answers
375 views

Print process ID (PID) of a Matlab instance

To run my Matlab scripts, I've created a shell script to which I give two parameters - the path to the matlab file ($1) and to the log file ($2): nohup time matlab -some_parameters -r "run $1;exit" ...
1
vote
1answer
1k views

How to kill the (last - 1) PID with bash

I know how to kill the last process with kill $! However I would like to kill the last−1 process, i.e. not the last one, but the one before the last one. I tried kill $$(($! -1)) but ...
3
votes
1answer
776 views

Why is brk(0) called?

On a first shell I run the command tail with no argument. On a second shell I kill the first tail using strace to monitor the system calls. qdii@nomada ~ $ strace kill 1713 execve("/bin/kill", ...
1
vote
2answers
415 views

How to safely kill processes so that output redirection is not aborted?

I'm writing some automation scripts, in which I need to kill some processes. Previously I would usually use kill -9 pid to kill processes but once upon a time, I notice that when I used kill -9 to ...
1
vote
2answers
83 views

How can I kill gnome shell widgets?

I have some gnome shell widgets that I need to be closed. I am unable to find which processes are behind them. Any idea how can I kill them?
2
votes
3answers
3k views

pkill can't kill processes with parent process id 1

I want to kill the following processes using pkill "run_tcp_sender.sh" or pkill -SIGKILL "run_tcp_sender.sh" root 14320 1 0 2012 ? 00:00:00 bash run_tcp_sender.sh ...
6
votes
2answers
226 views

Decode Flags for Kill Command

I am new to Shell Scripting. I saw this Command on a Book for Linux shell Scripting $ kill -HUP 1234 >killout.txt 2>killerr.txt I know what the command does, but i am not able to understand ...
4
votes
1answer
46 views

Suspend and edit previous single line commands

Say I want to modify the latter of some concatenated command line options, is it possible without killing the first command? Specifically I have compile and run scripts executed thusly: > compile ...
7
votes
2answers
506 views

Kill user processess on logout

I have a Ubuntu server that handles remote X sessions from users. However, I don't want to allow users to run any kind of background processes - so here is my question: How do I prevent users from ...