In computing, the process identifier (normally referred to as the process ID or just PID) is a number used by most operating system kernels, —such as that of UNIX, Mac OS X or Microsoft Windows— to temporarily uniquely identify a process. This number may be used as a parameter in various function calls allowing processes to be manipulated, such as adjusting the process's priority or killing it altogether.
Questions tagged [pid]
15 questions
18
votes
2 answers
Find the PID's of all threads of a process without ps or pidof
So the system I'm working on (BusyBox) has a ps that takes no command line arguments and pidof returns nothing even though it exists within /sbin and points to killall5.
Another issue I had is that top takes no -H, but you can hit h (not H) in top…
Madau
- 181
- 1
- 1
- 3
12
votes
3 answers
Obtaining PID of command earlier in Pipeline
I'm writing a bash script to use inotifywait to monitor a directory and kick off actions when changes are detected. Something like:
inotifywait -m ... | while read f; do something; done
Since inotifywait doesn't terminate by itself, this script…
Adrian Pronk
- 527
- 3
- 10
12
votes
3 answers
Why do top and ps show different PIDs for the same processes?
When I run top -H, I see that my multiple mysql threads all have the same PID. However, in ps -eLf I see each one has a different PID:
ps -eLf
UID PID PPID LWP C NLWP STIME TTY TIME CMD
mysql 1424 1 1424 0 17 18:41 ? …
Madan Ram
- 545
- 2
- 5
- 7
8
votes
5 answers
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 of that process and I have to use kill to send a…
gangadhars
- 697
- 3
- 15
- 21
6
votes
2 answers
Get the PID of file creation
I am writing a bash script that creates 5 files with the extension ".P" and write a line of "something" into them. "P" represents a number and it's the PID of the process that creates the file. How can you do that?
I am creating my file and writing…
Dragos Rizescu
- 1,369
- 2
- 9
- 13
5
votes
1 answer
How to monitor top applications using CPU (and IO if possible) in a graph?
I need to find what and when these applications used so much CPU (and IO if possible too). This should be in a graphic timeline like we see in GNOME System Monitor CPU History. I also want to compare that graphic with the Psensor temperature monitor…
Aquarius Power
- 4,099
- 5
- 38
- 56
4
votes
3 answers
how to determine how many times pid_max wrapped?
Is it even possible to know that? may be some kind of tests are required to be performed in order to find that information?
My system, just after I login, seem to have already wrapped the max_pid, so a still alive pid got the same pid of an old…
Aquarius Power
- 4,099
- 5
- 38
- 56
3
votes
2 answers
How does One Find the PID of a Process Started with startproc?
My understanding is that it's generally a good idea to create a PID file for daemon processes and that startproc is a good way to start these daemons.
I know that startproc takes -i and -p arguments that refer to PID files but it doesn't create a…
Adam George
- 41
- 4
3
votes
2 answers
How to monitor the last PID assigned by the kernel?
To monitor process creation I'd like to periodically write the last PID assigned by the kernel to any process on the system (not just processes created by the PID-monitoring program) with a time stamp to a file (using a daemon to avoid creating any…
l0b0
- 50,672
- 41
- 197
- 360
2
votes
5 answers
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 know what is killing the process. It is a Python…
dotancohen
- 15,494
- 26
- 80
- 116
1
vote
3 answers
ssh targetHost &; fg - does not work, but why?
I was trying the following combination in order to get the pid of the ssh session (running in the background displays the pid) and than fg to get back to the ssh session and introduce the password:
ssh targetHost &; fg
I get the following error:…
Andreea
- 13
- 2
1
vote
2 answers
Get command PID and send to another
I wanted to know if I can execute a command from the terminal and right after the command started I send its PID to another command to be monitored.
I need to do something like this,
dd if=/path/of/file of=/path/of/destination
And then I need to…
cesar.rickinho
- 83
- 6
1
vote
1 answer
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 /tmp/file.txt ]; then
for line in $(cat…
MLSC
- 972
- 7
- 21
- 28
0
votes
1 answer
How can I rejoin a process running
I am very new to using Linux. I have a 'machine' on Amazon and I was trying to learn how to use Python on this machine. I started running Python—had to step away for a few minutes and the connection was reset. I rejoined the connection and…
PyNEwbie
- 1,549
- 3
- 11
- 11
0
votes
1 answer
How to get pid of su --session-command file thats ran on there
This line ran in a script
su --session-command="$javaCommandLine & >>$serviceLogFile 2>&1 & echo \$! >$pidFile" $serviceUser || return 1
pid="$(<$pidFile)"
echo $pid
The Pid is increased by one from the Pid the program ran by su really is.
How I do…
SSpoke
- 165
- 1
- 3
- 12