The tag has no wiki summary.

learn more… | top users | synonyms

167
votes
7answers
72k views

When should I not kill -9 a process?

I am always very hesitant to run kill -9, but I see other admins do it almost routinely. I figure there is probably a sensible middle ground, so: When and why should kill -9 be used? When and why ...
67
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 ...
28
votes
2answers
2k views

Why is the default process creation mechanism fork?

The UNIX system call for process creation, fork(), creates a child process by copying the parent process. My understanding is that this is almost always followed by a call to exec() to replace the ...
25
votes
4answers
2k views

python vs bc in evaluating 6^6^6

I am evaluating the expression 6^6^6 using python and bc separately. The content of the python file is print 6**6**6. When I execute time python test.py, I get the output as real 0m0.067s ...
16
votes
4answers
1k views

What happens if you edit a script during execution?

I have a general question, which might be a result of misunderstanding of how processes are handled in Linux. For my purposes I am going to define a 'script' as a snippet of bash code saved to a text ...
15
votes
2answers
503 views

How are the processes in UNIX numbered?

I can't find any pattern when I look at the numbering of PIDs in process table (ps -a), as the PIDs are not subsequent numbers and sometimes there are large "gaps" between those numbers. Is it ...
13
votes
2answers
15k views

How can I kill a <defunct> process whose parent is init?

Transmission is intermittently hanging on my NAS. If I send SIGTERM, it doesn't disappear from the process list and a <defunct> label appears next to it. If I send a SIGKILL, it still doesn't ...
12
votes
2answers
3k views

Per process firewall?

I've been reading around but can't seem to find a way to create per-process firewall rules. I know about iptables --uid-owner but that only works for outgoing traffic. I've considered scripting ...
11
votes
1answer
4k views

What is the maximum value of the PID of a process?

What is the maximum value of the PID of a process? Also, is it possible to change the PID of a running process?
11
votes
9answers
3k views

Ensure a process is always running

I started hosting sites a while back using Cherokee. For external sources (FastCGI, etc) it has an option to launch the process if it can't find one running on the designated socket or port. This is ...
11
votes
4answers
419 views

Is there a top-like command that shows the network bandwidths and file accesses of running processes

For example, we'd like to see: PROCESS IF TX RX FILE(regular) R/W prog1 eth0 200kB/s 12kB/s -- -- wlan0 12kB/s 100kB/s -- ...
10
votes
2answers
1k views

Getting a window's PID by clicking on it

Is there any package which shows PID of a window by clicking on it?
9
votes
6answers
7k views

How to make a process invisible to other users?

How could you launch a process and make it invisible to the top command? The process is started by a normal user (not root), and should not be visible to other normal users.
9
votes
2answers
4k views

How to Throttle per process I/O to a max limit?

I'm looking for a way to limit a processes disk io to a set speed limit. Ideally the program would work similar to this: $ limitio --pid 32423 --write-limit 1M Limiting process 32423 to 1 megabyte ...
6
votes
3answers
269 views

Undo bg; Undo putting a process into the background?

I've started a long running and machine hog process. I've hit CTRL-Z to stop it. I've then put it in the background with bg. Oops, I should have restarted with fg so that I could easily stop and start ...
6
votes
4answers
5k views

'kill java' doesn't kill java

I am running debian right now and sometimes I need to kill java manually from the terminal, but when I try kill #pid# or pkill java nothing happens. No console output (ok, that's normal) and java is ...
6
votes
2answers
267 views

How is a graphical application started from a bash session connected to that bash session?

When I start a graphical application from a terminal running bash, that application is somehow connected to that bash session. For example, when the applications dumps some text it will appear in the ...
6
votes
2answers
1k views

kill -9 hangs, unable to kill process (murder proof process) [duplicate]

Possible Duplicate: What if ‘kill -9’ does not work? I guess its a bit late to ask this, but for future reference; I was called to look at a server today after a customer was reporting ...
6
votes
2answers
3k views

How to check, which limit was exceeded? (Process terminated because of ulimit. )

Let's assume process runs in ulimited environment : ( ulimit ... -v ... -t ... -x 0 ... ./program ) Program is terminated. There might be many reasons : memory/time/file limit exceeded ; just ...
5
votes
1answer
8k views

What does this process STAT indicates?

If you check the STAT column in above image you will see Ss S S< SN and R+ What does this indicates ? Process states. If yes,Then what is the significance of 'Ss S< SN and R+'?
5
votes
3answers
3k views

What is a command to find priority of process in Linux?

How can i view the priority of a specific process ?
5
votes
1answer
2k views

What does <defunct> mean in the output of ps?

I had issued the ps -ef|grep java command and this is one of the entries that I got : subhrcho 875 803 0 Jan23 pts/5 00:02:27 [java] <defunct> What is <defunct> implying here ? ...
5
votes
2answers
22k views

How can I see what processes are running?

I use Ubuntu Server 10.10 and I would like to see what processes are running. I know that PostgreSQL is running on my machine but I can not see it with the top or ps commands, so I assume that they ...
5
votes
3answers
227 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 ...
5
votes
3answers
434 views

Simple queuing system?

Given a commodity PC, we would like to use it to execute some tasks in the background round the clock. Basically, we would like to have commands like: add-task *insert command here* list-tasks ...
5
votes
2answers
432 views

Set process exclusivity in Linux

I am trying to measure the performance of a process. I have widely ranging performance measurements on small bit of single-threaded deterministic code that should perform the same every time. I would ...
4
votes
1answer
95 views

Is it the process that cleans itself on termination or the kernel?

Recently I found this in a powerpoint presentation: When a program is compiled and linked, the linker inserts some extra code in the program. It is this code that calls the main function about the ...
4
votes
1answer
82 views

What is the default or most commonly used multiprocessing model in Linux? Symmetric or Asymmetric?

What the multiprocessing model for Linux? Is there a default or most commonly used model? Is it similar or very different from say BSD or even the MS Windows kernel? If SMP is used normally, can ...
4
votes
3answers
643 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 ...
4
votes
1answer
433 views

What is the difference between exiting a process via Ctrl+C vs issuing a kill -9 command?

I know I can kill any process with kill -9 command . But sometimes i see that even if I have terminated a program with CTRL+C , the process doesn't get killed . So I want to know the difference ...
4
votes
1answer
340 views

A script's background process is still alive after closing the terminal

This is more of a process management/signal handling question than a Bash question. It just uses Bash to explain the issue. I'm running a Bash script in which I run a background process. This is the ...
4
votes
2answers
199 views

How can I synchronize processes started in different TMUX panes?

Consider this: tmux split-window -d program1 program2 # this program depends on some side effects produced by program1 In this case, program2 will start before program1 is ready. program1 will send ...
4
votes
1answer
171 views

Discard stdout of a command for t seconds

I am working on some batch scripts involving the following: Run some non-terminating sub-processes (asynchronously) Wait for t seconds Perform other task X for some time Terminate subprocesses ...
4
votes
1answer
98 views

Understanding when background process gets terminated

I have a script which starts a number of background processes and if works fine when called from the cmdline. However the same script is also called during my xsession startup and additionally on ...
3
votes
3answers
1k views

What happens to suspended jobs in unix?

We can issue CTRL+Z to suspend any jobs in Unix and then later on bring them back to life using fg or bg. I want to understand what happens to those jobs that are suspended like this ? Are they ...
3
votes
4answers
721 views

How to run java process to be seen not as 'java…' in processes list?

Is it possible to run a Java process in Linux in a way that it could be seen in ps as some sort of alias? It would be easier to restart it when it is down.
3
votes
3answers
70 views

Disallow File IO for a process except for FIFOs

How do you start a process that cannot do any file IO (opening / closing files, creating / deleting files, reading / writing files, etc.), except to read and write to pre-created FIFOs? (chroot will ...
3
votes
2answers
170 views

Running a daemon as a non-privileged user

I am trying to set up a Thin Ruby application server on my Ubuntu VPS. I have created a specific account, installed rbenv under it along with all gems. I am looking for a convenient way to obtain the ...
3
votes
2answers
647 views

What is meant by stack in connection to a process?

From the book Advanced programming in the Unix environment I read the following line regarding threads in Unix like systems All the threads within a process share the same address space, file ...
3
votes
2answers
191 views

Why can't pgrep find scripts started via env?

For example: $ cat foo.sh #!/usr/bin/env bash while true; do sleep 1 ; done $ ./foo.sh & $ pgrep foo.sh $ Contrast with: $ cat bar.sh #!/bin/bash while true; do sleep 1 ; done $ ./bar.sh & ...
3
votes
2answers
921 views

Program to test CPU load and process priority

I am running some test on Amazon EC2 instances and we want to make the CPU always busy at above 80%. What I have is a program main that needs to run in high priority and I want to launch another ...
3
votes
2answers
2k views

How to find how many cores a process is using?

I have a eight core machine. How can I find out how many cores are used by processes that I see in htop?
3
votes
1answer
53 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 ...
3
votes
1answer
47 views

Whats the correct value to base the maximum number of CPU's to sched_setaffinity to?

I have some confusion as to whats the correct value to use for the number of CPU's I can use to make a CPU_SET for a sched_setaffinity call on my system. My /proc/cpuinfo file: processor : 0 ...
3
votes
1answer
48 views

Reporting cpu hogs

Once in a while some program (ok, usually it's firefox) will start eating up nearly 100% of a processor's cpu time, heating up the processor and driving down by laptop's battery life. Since it's not ...
2
votes
2answers
158 views

End process from another SSH window

I forgot to use screen and I have a task that has been running for quite some time, and I do not want to lose the saved data. Basically Ctrlc will end the task and save the data if I am on the same ...
2
votes
3answers
3k views

What is the difference between ps and top command?

What is the difference between ps and top command ? I see that both can display information about running processes . Which one should be used when ?
2
votes
2answers
105 views

How to make processes not die after its parent dies?

I've been messing with forkbombs and noticed that if I just fork() processes repeatedly, killing the initial process will bring down the whole tree. This is not the case for forkbombs written in BASH ...
2
votes
1answer
752 views

Does a process invoking oom-killer kill itself?

Looking through syslog, I see lines like dd invoked oom-killer. Does this mean dd is being killed by the oom-killer or does it mean dd asked oom-killer to go kill another high memory process?
2
votes
2answers
119 views

How to constrain the resources an application can use on a linux web server

This is the situation: I have a PHP/MySQL web application that does some PDF processing and thumbnail creation. This is done by using some 3rd party command line software on the server. Both kinds of ...