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

learn more… | top users | synonyms

1
vote
1answer
43 views

How to kill - softly? [duplicate]

If I want to kill a process as careful and politely as possible, which signals should I use in a kill command, in which order? I would like to give the programm any kind of time to clean up, if it ...
3
votes
1answer
36 views

Triggering Bash Before Killed [closed]

I just made some kind of service code. Check this out: do_start() { while true do if [[ $(pgrep -fl loopsvn.sh | wc -l) -gt 2 ]]; then echo "Already use by another ...
5
votes
3answers
68 views

How to kill all open windows?

I want to close all windows appearing on my desktop. I've thought to do this through pkill, but I could only manage to kill them one at a time, which is not what I want. The end goal is to put this ...
2
votes
1answer
56 views

How to terminate a shell script?

I'm working on a supercomputer and have a shell script that will automatically schedule a bunch of jobs for me. Once the script is run, I can terminate manually with Ctrl+C. I was running the script ...
2
votes
0answers
27 views

kill or kick all clients from a running vncserver without restarting the server

I encounter quite often the problem, that I want to kick all connected clients from a running vncserver. Even better would be to be able to kick / kill even certain clients. With netstat -tupa | grep ...
3
votes
1answer
37 views

Process management and pkill

I've been studying process management using shell scripts and I'm starting to realise how difficult it is to make sure that it's done right. For example, you can record the PID of a program to a ...
2
votes
1answer
49 views

Kill any service running at a specific port

I am trying to write a script that kills service running at a specific port. This is my script: a=$(ps ax | grep 4990 | grep java | awk '{print $1}') kill -9 $a It's a java program. This script ...
2
votes
1answer
83 views

how to execute more than one command gnome-terminal

I have a script which is running some of (more than 15) applications like: cd mypath sleep 1 gnome-terminal -t App1 --tab -e "./App1" sleep 1 gnome-terminal -t App2 --tab -e "./App2" .. .. sleep ...
2
votes
0answers
26 views

In AwesomeWM, is the use of `c:kill()` as soft as clicking on the red cross in another window manager?

In AwesomeWM, windows are closed with the method c:kill() (bound to Meta-Shift-c) When I use that key binding, the window just close instantly! Therefore I wondered : Is that way as soft as ...
1
vote
1answer
27 views

killall <processname> throughout the system [closed]

I'm opening two terminal windows. Terminal 1 - I run process1 Terminal 2 - I run process2 I then terminate both process using Ctrl+Z in each window. I type killall -9 process1 in Terminal 2 , ...
3
votes
1answer
28 views

Interrupting very long output in tmux

In a (gnome) terminal, if I cat a file which turns out to be much too long, I can always press Ctrl-c to interrupt. However, in tmux, when the same happens, it takes long for the signal produced by ...
2
votes
2answers
98 views

Killing subprocesses after the script has finished or is killed

Say I have a script like the following #!/usr/bin/env zsh ./subscript.sh & # do stuff ... # do more stuff I would like the process running subscript.sh (and any processes initiated by it) to be ...
2
votes
1answer
39 views

Guard against killing an already killed process

I'm writing a script that tries to kill a process. But the process might already been killed by others. How can I guard against it and prevent this kill command from terminating my process with ...
24
votes
2answers
2k views

Will Linux start killing my processes without asking me if memory gets short?

I was running a shell script with commands to run several memory-intensive programs (2-5 GB) back-to-back. When I went back to check on the progress of my script I was surprised to discover that some ...
1
vote
1answer
73 views

kill pid is not working? [duplicate]

This is pretty weird now. I am trying to kill a process by using its pid but it is not working at all. root@machineA:/home/david# ps aux | grep modelling david 5075 0.0 0.0 1285420 29404 ? ...
1
vote
2answers
55 views

Temporarily freeze a process upon shell interaction

Let's say on a single console I have tail -F running, showing the output of many log files in realtime. Sometimes I need to run commands there too, however, and examine their output briefly, without ...
1
vote
1answer
102 views

nodejs sub processes in nohup bash script lock up

I run scripts with nohup that contain a list of a few hundred to a few thousand nodejs commands. These nodejs sub processes sync data from mysql and salesforce to couchdb. $ nohup ...
1
vote
1answer
36 views

getting pid of two last commands executed in background and do stuff

I wrote this bash: #!/bin/bash eval "(a command) &" pid1=$! eval "(while kill -0 $pid1; do .... ; done) &" #It creates file.txt after few seconds pid2=$! if [ -s ...
3
votes
5answers
257 views

Run a process to particular/dedicated pid only

I have a c program executable or shell script which I want to run very often. If I want to stop/pause or to notify something I will send signal to that process. So every time I have to check the pid ...
3
votes
5answers
616 views

Getting pid of bash script from itself

I have a bash script with doing lot of things called script.sh: #!/bin/bash #It #Is #Doing #Things Is there a way that I be able to get the proccess of script and then kill it after 5 minutes? ...
2
votes
2answers
80 views

Killing background process in bash script when exiting the script

I have a script that tail a file while displaying a clock in the top right corner. I took the clock part from the internet, and it works ok. The entire script is something like (I simplified): while ...
4
votes
3answers
61 views

How to send SIGKILLs to entire pipeline?

while true; do # process substitution instead of usual pipeline to avoid waiting for all programs handle_input_with_timeout < <( prog1 | prog2 | prog3 ) echo "Data stopped flowing. ...
0
votes
1answer
79 views

Job started by procmail does not appear in ps-output and cannot be stopped, even not after reboot

For testing purposes I called procmail by my .forward file |/usr/bin/procmail and by the rules in .procmailrc it started a job named "start", which was simply an infinite loop while true do ...
0
votes
1answer
146 views

Directory locked! [closed]

I have been trying to install virtualbox using this command: sudo apt-get install virtualbox.qt But I am getting this error: E: Unable to lock directory /var/cache/apt/archives/ I have been ...
8
votes
4answers
311 views

Terminate every background process

I have a few Stopped background processes. kill $(jobs -p) and kill `jobs -p` have no effect kill %1, kill %2, etc. successfully terminate individual processes How can I kill every background ...
6
votes
5answers
2k views

Kill all descendant processes [duplicate]

I'm writing an application. It has the ability to spawn various external processes. When the application closes, I want any processes it has spawned to be killed. Sounds easy enough, right? Look up ...
2
votes
2answers
39 views

Output of one command is piped to another one; how to close both?

I call Qt Assistant like suggested on stackoverflow: nc -lkU ~/.assistantfifo | assistant -enableRemoteControl & Qt Assistant window is opened, and if I call jobs, it returns: [1] + running ...
2
votes
2answers
109 views

Bash script to signal a concurrently running instance (same script) about a condition and increment counter

Background Here's what I want to achieve. I have a (potentially) long-running process. Now I have locking in place just fine and all is generally in order. However, since this is a scheduled job, ...
0
votes
1answer
65 views

Can a script be running even after it's been killed?

I know it sounds so stupid and I know it IS stupid but I ran a unix script to send me and my friend emails every few seconds to test mailx. Stupid thing is I used $ while true; do blah blah blah... ...
0
votes
2answers
71 views

Why does kill not have a parameter for file and not for port number?

If I want to stop a program given its tcp port number or its file or named executable, can I run something like kill -tcpPortNumber $1 where the parameter $1 is a tcp port number or kill -filename $1 ...
3
votes
1answer
79 views

Better way to kill all processes with a handle to some file

This kills every process with a handle to file /foo/bar (in bash): lsof /foo/bar 2>&1 | grep "/foo/bar" | sed "s/ */\\t/g" | cut -f 2 | while read PID; do kill $PID; done This does not ...
2
votes
1answer
60 views

Is uninterruptible sleep the only case?

French wikipedia say: Un processus en sommeil ininterruptible ne peut s'arrêter (ni libérer ses ressources) même lorsque SIGKILL apparaît. Il s'agit d'un des rares cas dans lequel un système ...
70
votes
2answers
5k views

How does Linux “kill” a process?

It often baffles me that, although I have been working professionally with computers for several decades and Linux for a decade, I actually treat most of the OS' functionality as a black box, not ...
5
votes
2answers
245 views

Processes do not respond to my signals

I have a strange behavior on my system. When I invoke a command in the shell (bash version 4.2.45(1)-release), say top or cat, the running program (the process) does not respond to Ctrl+C. I even ...
3
votes
1answer
57 views

How (if possible) can I terminate a specific blocker hanging a program?

I have a number of files open in my editor (geany). I managed to hang it doing a sort on a large list that I should have saved and just sent through a pipe to sort via command-line (I mapped one of ...
33
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
183 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
127 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
274 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 ...
13
votes
3answers
9k 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. ...
0
votes
3answers
994 views

Cannot kill teamviewer process

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
1k 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
351 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
68 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
243 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 ...
9
votes
3answers
3k 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
191 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
35 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.
1
vote
2answers
1k 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)