A process is an instance of a computer program that is being executed.
5
votes
1answer
399 views
How can I search/browse in some process's memory?
I'm using MacOS X 10.7 and I'm not very familiar with unix. Is there a command for a search in some process's memory for a string?
5
votes
2answers
1k views
Hide processes from other users based on groups (under Linux)?
Is it possible to configure process hiding for certain user groups under a linux system?
For example: Users from group X should not see processes owned by users from group Y in ps/top or under /proc.
...
4
votes
3answers
929 views
How to kill two or more processes with one kill command?
I am using the following command to kill one java process via shell script:
pidof java|xargs kill -9 $1
What if the list of pidof output has more than one elements? How do I kill them both with ...
4
votes
6answers
884 views
Kill many instances of a running process with one command
This is one of the questions that has troubled me often. Suppose I have thousand or more instances of any process(for e.g. say the process vi) running. How do I kill them all in one single shot/one ...
4
votes
3answers
839 views
How do I get a mapping of Pid to Port?
I have a process which I need to run on a specific port. I have started some other process on that port and I need to kill it.
Unfortunately, I don't remember the name/pid of the other process so I ...
4
votes
2answers
2k views
How to pkill by “command name”?
So I'm executing a command like:
COMMANDNAME -PARAMETERS
But..why can't I kill it with "pkill"? I'm trying with:
pkill -9 "COMMANDNAME -PARAMETERS"
but it doesn't kills the "COMMANDNAME ...
4
votes
3answers
260 views
What call before a fork?
A long while ago I went to a job interview with a thoroughly weird company in London who claimed to be expert Unix consultants. Anyway these people were complete nutters and not surprisingly the ...
4
votes
2answers
937 views
Preventing program from using internet
Is there a way to block certain programs from being able to connect to the internet in Debian (a firewall blocking outgoing connections), so for example, to block a windows program running in wine ...
4
votes
2answers
451 views
Are kernel threads really kernel processes?
I've read in many places that Linux creates a kernel thread for each user thread in a Java VM. (I see the term "kernel thread" used in two different ways:
a thread created to do core OS work and
a ...
4
votes
3answers
325 views
What is a subshell (in the context of the documentation of make)?
I'm reading a book about the make command and there is a paragraph:
If any of the prerequisites has an associated rule, make attempts to
update those first. Next, the target file is considered. ...
4
votes
4answers
245 views
why new pid is smaller than the old ones?
Is there any chance the new process's pid is smaller than the existed ones ?
I have a daemon process which will restart when be killed, I recorded the pids,
and found that the pid first came smaller, ...
4
votes
1answer
229 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 ? ...
4
votes
1answer
177 views
root owned program with setuid bit on
Ping is a a program owned by root with the user id bit set.
$ ls -l `which ping`
-rwsr-xr-x 1 root root 35752 Nov 4 2011 /bin/ping
As I understand it, if a user runs the ping process, then the ...
4
votes
3answers
298 views
How to poll existence of a background script correctly
I have a problem with the following kind of script:
#!/bin/sh
long_running_script.sh &
while [ `pidof long_running_script.sh` ]
do
echo "."
sleep 1
done
The sript will ...
4
votes
1answer
90 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
2answers
3k views
Launch process as another user/group (in init.d script)
I am editing a init.d script. The init.d script runs a utility script which then runs an process. From either bash scripts how would I make it launch the main process as a specific user and group?
4
votes
3answers
2k views
How to find which Process is causing High CPU usage
Is there any way to find out from terminal which process is causing high CPU Usage ?
It would also be useful to order processes in descending order of cpu Usage
4
votes
3answers
66 views
Can I pipe any two processes to each other?
In this page from The Design and Implementation of the 4.4BSD Operating System, it is said that:
A major difference between pipes and sockets is that pipes require a
common parent process to set ...
4
votes
1answer
623 views
How do I tell a script to wait for a process to start accepting requests on a port?
I need a command that will wait for a process to start accepting requests on a specific port.
Is there something in linux that does that?
while (checkAlive -host localhost -port 13000 == false)
...
4
votes
2answers
8k 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 ...
4
votes
1answer
2k views
Execute Nohup command with input
In UNIX, I have a process that I want to run using nohup. However this process will at some point wait at a prompt where I have to enter yes or no for it to continue. So far, in UNIX I have been doing ...
4
votes
3answers
51 views
Dynamic file content generation: Satisfying a 'file open' by a 'process execution'
I have a read-only file, F.
A program, P, that I'm not the author of, needs to read F.
I want the content of F to come from another 'generator' program, G, whenever P tries to read F (taking F to ...
4
votes
1answer
712 views
Nice and child processes
Can someone tell me what the relationship between a specified nice level and child processes ?
for example, if I have a default nice of 0, and i start a script with nice 5, which in turn starts some ...
4
votes
3answers
115 views
Why is there a type for process ids (pid_t), but not for file descriptors (fd)?
I see that pid_t is typedef'd in unistd.h, and file descriptors are defined to be int in fcntl.h. But since they are used in similar ways, wouldn't it make sense to have a typedef for file ...
4
votes
5answers
101 views
Is a persistent zombie process sign of a bug?
(OS: Debian variant.)
Having a process with zombie-status. The PPid belonged to a gvim process.
The contents of /proc/[pid]/wchan is do_exit,
/comm is sh and /cmdline is empty, /status is shown ...
4
votes
2answers
116 views
Why is I/O uninterruptible?
What is the rationale behind making I/O uninterruptible? What would be the negative consequences if a process handling I/O were allowed to handle a signal?
4
votes
2answers
490 views
Linux running slow with 0 swap left
Our Linux server is responding very slowly. top doesn't show any excessive CPU usage. I noticed that even though there's about 5GB of free memory, the system is using all of swap with no free swap ...
4
votes
1answer
832 views
Why is my C++ program killed by OS
I've compiled small C++ application for school project on my virtual ubuntu 11.04. However when I attempt to run it over some larger data set after ~20 sec the program is killed by OS.
Killed ...
4
votes
1answer
916 views
All about ssh ProxyCommand
I am looking for an in-depth explanation of the following ProxyCommand, down to the nuts and bolts of its operation, please. Can you kindly completely dissect it for me and improve on it if you can? ...
4
votes
2answers
261 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
...
4
votes
1answer
755 views
Disable random memory address generation in my programs
I'm reading "The art of exploitation" and would like to try some experiments, including reading from and writing to various memory address. I've created some simple programs and trying to overwrite ...
4
votes
2answers
861 views
Number of running processes show in top
The usual maximum number that I have seen in the "running" field displayed in top(1) is the number of logical CPUs installed in the system. However, I have observed that under Ubuntu 10.04 (not ...
4
votes
1answer
41 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 ...
4
votes
1answer
90 views
Elegantly get list of children processes
I would like to get a list of all the processes whose parent is $pid. This is the simplest way I've come up with:
pstree -p $pid | tr "\n" " " |sed "s/[^0-9]/ /g" |sed "s/\s\s*/ /g"
Is there any ...
4
votes
1answer
487 views
Difference between poll_s and ep_poll WCHAN in ps output
When I issue ps -elf|grep python for example on my system, I see these:
1 S 1000 6020 6008 0 80 0 - 9914 poll_s Jul12 ? 00:00:01 python manage.py run_gunicorn -t 3600 -w 8 -b ...
4
votes
1answer
3k views
Need explanation on Resident Set Size/Virtual Size
I found that pidstat would be a good tool to monitor processes. I want to calculate the average memory usage of a particular process. Here is an example output:
02:34:36 PM PID minflt/s ...
4
votes
4answers
445 views
How does forking affect a process's memory layout?
Please see the following figure showing the memory layout of a process:
:
When someone forks(), and a new task_struct is assigned, what happens to the addresses of the process? In more or less other ...
4
votes
1answer
317 views
controlling a process from a different session
So, I ssh into my remote computer and launch a process... time passes... my ssh session breaks. I log in again, and of course, I don't have access to the original process now. I can see it still if I ...
4
votes
2answers
180 views
start process so that it can't spawn new ones
Is it possible to start new process so that it couldn't spawn new ones (untrusted code)?
Also how do I start a process so it couldn't make any input/output to files and in general any devices?
4
votes
1answer
45 views
How to monitor all executions of an executable over a time period
I know how to monitor a process. Commands like top and so forth can monitor the CPU time and memory usage for a given process instance.
But say I expect a given executable to be run several times in ...
4
votes
2answers
355 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
236 views
Is it possible to send a keyboard event to a background script that's expecting user interaction? (Using 'read')
Ex:
$read &
[1] 15139
[1]+ Stopped
$jobs -l
[1]+ 15139 Stopped (tty input) read
4
votes
3answers
2k views
when does the system send a SIGTERM to a process?
My server program received a SIGTERM and stopped (with exit code 0). I am surprised by this, as I am pretty sure that there was plenty of memory for it. Under what conditions does linux (busybox) send ...
4
votes
2answers
104 views
How to kill a process giving it a number of seconds before a doing the forced kill?
I do have the PID of the process to be killed but I do want to give it the chance to die peacefully, without doing a -9.
Expected behaviour: check if PID is still running for up to ten seconds and do ...
4
votes
3answers
236 views
Silently start task in background
I know that you can use this to start a process in the background, without getting the notification when the process is put in the background and when it is done like so:
(command &) &> /dev/null
...
4
votes
2answers
2k views
Write inside a socket open by another process in Linux
Is it possible on Linux for a process to write inside a socket open by another one?
Let's say I open a connection to google.com using netcat:
myuser@linux:~$ nc google.com 80
Now I can lookup for ...
4
votes
1answer
650 views
File descriptor limits are lost after a system reboot
I'm trying to increase the default file descriptor limits for processes on my system. Specifically I'm trying to get the limits to apply to the Condor daemon and its sub-processes when the machine ...
4
votes
1answer
54 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 ...
4
votes
1answer
658 views
Detailed Per-Process Profiling
I am looking for a way to profile a single process including time spent for CPU, I/O, memory usage over time and optionally system calls.
I already know callgrind offering some basic profiling ...
3
votes
2answers
1k views
Slow down a process without affecting other processes
I have a program. When it is running, the CPU temperature raise from
50 to 80 Celcius, which is my major concern.
I can control the CPU frequency to slow it down, but other processes
will be slowed ...
