Sponsored Content
Full Discussion: finding process id
Top Forums UNIX for Dummies Questions & Answers finding process id Post 19354 by mikek147 on Wednesday 10th of April 2002 04:23:29 AM
Old 04-10-2002
OK. Let's go at this from another direction.

If you type:

who am i

you wil get a response like:

root pts/0 Apr 10 03:53 (:0.0)

pts0 is the terminal window I typed the 'who am i' command. Now if I type:

who -uH

I get:

NAME LINE TIME IDLE PID COMMENT
root pts/0 Apr 10 03:53 . 1177 (:0.0)
root pts/1 Apr 10 03:53 00:01 1176 (:0.0)

All users logged into your system would be listed under the NAME column. You'll notice the PID column, This is the pid of the shells running in the two windows I have open, as root. OK, now lets run:

ps -ef | grep 1177

on the PID of shell running on /dev/pts/0. I get:

UID PID PPID C STIME TTY TIME CMD
root 1177 1171 0 03:53 pts/0 00:00:00 bash
root 1252 1177 0 03:55 pts/0 00:00:00 ps -ef
root 1253 1177 0 03:55 pts/0 00:00:00 grep 1177

You'll see that 1177 is the PID of bash and the PPID of both 'ps' and 'grep'. You'll also see that in the TTY column, it also references the TTY the commands where run in.

Basically, with the use of 'ps -ef' and 'who -uH', you can determine any command run by any user in any window or terminal. I hope this helps. -mk
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Finding Out When A Process Has Finished?

Problem I have an application which basically runs lots of UNIX programs remotely, using the Telnet protocol. For each program it remotely executes, it stores the process ID (PID) for that process. At regular intervals, I would like my application to take the PID for every process still... (5 Replies)
Discussion started by: 1cuervo
5 Replies

2. UNIX for Dummies Questions & Answers

Finding out process id in a scipt

Hi, If in a shell script i write a command ls > bla & ls The output is redirected to bla and the next ls starts as first one is going on in background. I want to find the PID of the first command. Thanks in advance (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies

3. Shell Programming and Scripting

finding Background Process Id

Hi Gurus, How can i find background process is completed or not. I have mentioned my scenario below. Actually Pr1 Process is running in back ground, i just want to know whether this process completed or not. I can come to know the process id by typing pid=$! but i want to trigger... (4 Replies)
Discussion started by: krk_555
4 Replies

4. Linux

Need help in finding process

Hello, Iam running a apache webserver in CentOS recenlty a hacker has attacked my server using RFI attack and did something in my server.. After that everyday at 8Pm my httpd is using about 5000 pid's actually in normal it takes only about 30 - 40 pid's. and also exim uses 2000 pid's totally my... (2 Replies)
Discussion started by: dheeraj4uuu
2 Replies

5. Shell Programming and Scripting

Finding the process id of the process using the ports

Hi Any idea how to get the process id of the process using the ports lsof -i :portnumber does not work in my machine. I am on sun Solaris SPARC. Any suggestion is highly appreciated (1 Reply)
Discussion started by: kinny
1 Replies

6. UNIX for Advanced & Expert Users

Finding process id of subsequent process

hi all, I am trying to find the process id of the subsequent process created via fork and exec calls in perl. For eg: envVarSetter dataCruncher.exe < input.txt > output.txt When I fork and exec the above command, it returns only the pid of envVarSetter and I don't know how to find the... (9 Replies)
Discussion started by: matrixmadhan
9 Replies

7. UNIX for Dummies Questions & Answers

Finding a rogue process

Afternoon all, hopefully someone can give me a hand with this (the following may be explained very poorly :rolleyes: ) I know there's a process running on one of our Solaris 10 boxes that runs approximately every 5 minutes. Unfortunately I've no idea, who owns it, what it is called, or how it is... (2 Replies)
Discussion started by: dlam
2 Replies

8. Shell Programming and Scripting

Finding process which ended another process

Hello, The scenario is as follows, I have a background process running initially for which i know the PID on machine1. I use ssh from machine 2 to execute a script in machine 1. For some reason the back ground process is terminated. I would like to know which process caused the... (6 Replies)
Discussion started by: prasbala
6 Replies

9. Shell Programming and Scripting

Finding a file process ?

Hi, I am trying to find a file that have a different name than it should be processing, the file name is ( Fifa15 ) is there a command to use? I got that file by ps -ef | grep fifa15 but how do I know what is running ? thanks a lot, I am learning unix so sorry if that is a... (2 Replies)
Discussion started by: latinooo
2 Replies
PTS_QUIT(1)						       AFS Command Reference						       PTS_QUIT(1)

NAME
pts_quit - Exit from pts interactive mode SYNOPSIS
pts quit [-cell] <cell name> [-noauth] [-localauth] [-force] pts q [-c] <cell name> [-n] [-l] [-f] DESCRIPTION
The pts quit command exits from pts interactive mode. The command can be run from the command line or interactively, but on the command line it does nothing and is therefore of questionable utility. CAUTIONS
Prior to OpenAFS 1.4.5 and OpenAFS 1.5.23, the pts quit command was only available on Unix or Linux and when OpenAFS was compiled with the supergroups option (disabled by default). As of OpenAFS 1.4.5 and 1.5.23, it is always available. OPTIONS
Although they have no effect, pts quit takes the following standard pts options: -cell <cell name> Names the cell in which to run the command. For more details, see pts(1). -force Enables the command to continue executing as far as possible when errors or other problems occur, rather than halting execution at the first error. -help Prints the online help for this command. All other valid options are ignored. -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. Do not combine this flag with the -cell or -noauth options. For more details, see pts(1). -noauth Assigns the unprivileged identity anonymous to the issuer. For more details, see pts(1). OUTPUT
This command produces no output. EXAMPLES
Here is an example of a pts interactive session: % pts interactive pts> quit % SEE ALSO
pts(1), pts_interactive(1) COPYRIGHT
Copyright 2007 Jason Edgecombe <jason@rampaginggeek.com> This documentation is covered by the BSD License as written in the doc/LICENSE file. This man page was written by Jason Edgecombe for OpenAFS. OpenAFS 2014-04-08 PTS_QUIT(1)
All times are GMT -4. The time now is 12:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy