Sponsored Content
Top Forums Shell Programming and Scripting Tracking process via ps command Post 302853409 by learnbash on Saturday 14th of September 2013 05:34:30 AM
Old 09-14-2013
If i don't want to mention the path. Below command is fine?

Code:
# pgrep  -n ^httpd$
9561

# echo $?
0

cross-checking

# pgrep  -n ^httpd1$


# echo $?
1

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

process command

I'm looking for a specific command to extract the libraries linked to a specific process. Would someone get an idea ?? (2 Replies)
Discussion started by: tonoche
2 Replies

2. UNIX for Advanced & Expert Users

Command Tracking

Hi, OS: Solaris9, SPARC Is there any way I can track the commands run by users from the shell prompt? Example: Somebody is deleting files from the system. Who it is is a mystery. That person obviously does not use bash prompt so there is no history. Is there anyway I can find out who... (5 Replies)
Discussion started by: mahatma
5 Replies

3. Shell Programming and Scripting

Process ID of Command

I need a way to get the Process ID of the last command I executed in a script. Not the last background process but the last command. For example, suppose I am executing a binary inside a script like so. binary.program argument1 argument2 If this binary program runs fast, is there a... (4 Replies)
Discussion started by: scotbuff
4 Replies

4. UNIX for Advanced & Expert Users

Tracking user

dear all, I'm facing problem that is i have noticed from few days back that some body is deleting and making changes in the file from developement server where i'm working(in unix) so i want to track that who is using the server, what performancr they are doing and each every thing which r... (5 Replies)
Discussion started by: panknil
5 Replies

5. UNIX for Advanced & Expert Users

Tracking down the problem

Is there a way to track down what process is sending to a certain port? I have some thing pounding the network with requests to a multicast IP that doesn't exist. I have shut down all comms related processes and yet it is still there. Need a way to track the port or IP back to the process. Thanks... (3 Replies)
Discussion started by: mattmanuel
3 Replies

6. IP Networking

Routing by connection tracking

Hello, I have switch port, that allows only a single MAC/IP connected to it. - But, I would like to connect two hosts, without any additional private network. (No NAT.) Therefore the plan is adding a linux router doing proxy-arp with three interfaces, one for host1, one for host2 and one... (2 Replies)
Discussion started by: michas
2 Replies

7. Red Hat

Tracking Process to a particular

I've tried to see what I can find on my own but I'm coming up with goose eggs. Basically I was wondering if there was a way of querying the scheduler (or something similar) to track a process back to a particular CPU it's executing on at the time of the command. ps has a "cpu" output option but... (1 Reply)
Discussion started by: thmnetwork
1 Replies

8. Shell Programming and Scripting

Tracking users through history command

Hi folks, I have the basic query that there are 3 unix boxes having their individual access now in my team there are 4 members who are using the same credentials to access those 3 boxes through putty ssh from their windows desktop , now if i want to check which 4 members have executed the... (1 Reply)
Discussion started by: punpun66
1 Replies

9. UNIX for Advanced & Expert Users

Issue with tracking successful completion of Child process running in background

Hello All, I am using Linux. I have two scripts: inner_script.ksh main_wrapper_calling_inner.ksh Below is the code snippet of the main_wrapper_calling_inner.ksh: #!/bin/ksh ppids=() ---> Main array for process ids. fppids=() ---> array to capture failed process ids. pcnt=0 --->... (5 Replies)
Discussion started by: dmukherjee
5 Replies

10. Shell Programming and Scripting

Command to get exact tomcat process I am running ignoring other java process

Team, I have multiple batchjobs running in VM, if I do ps -ef |grep java or tomcat I am getting multiple process list. How do I get my exact tomcat process running and that is unique? via shell script? (4 Replies)
Discussion started by: Ghanshyam Ratho
4 Replies
PKILL(1)						    BSD General Commands Manual 						  PKILL(1)

NAME
pkill -- find or signal processes by name SYNOPSIS
pgrep [-filnvx] [-d delim] [-G gid] [-g pgrp] [-P ppid] [-s sid] [-t tty] [-U uid] [-u euid] pattern ... pkill [-signal] [-filnvx] [-G gid] [-g pgrp] [-P ppid] [-s sid] [-t tty] [-U uid] [-u euid] pattern ... prenice [-l] priority pattern ... DESCRIPTION
The pgrep command searches the process table on the running system and prints the process IDs of all processes that match the criteria given on the command line. The pkill command searches the process table on the running system and signals all processes that match the criteria given on the command line. The prenice command searches the process table on the running system and sets the priority of all processes that match the criteria given on the command line. The following options are available for pkill and pgrep: -d delim Specify a delimiter to be printed between each process ID. The default is a newline. This option can only be used with the pgrep command. -f Match against full argument lists. The default is to match against process names. -G gid Restrict matches to processes with a real group ID in the comma-separated list gid. -g pgrp Restrict matches to processes with a process group ID in the comma-separated list pgrp. The value zero is taken to mean the process group ID of the running pgrep or pkill command. -i Ignore case distinctions in both the process table and the supplied pattern. -l Long output. Print the process name in addition to the process ID for each matching process. If used in conjunction with -f, print the process ID and the full argument list for each matching process. -n Match only the most recently created process, if any. -P ppid Restrict matches to processes with a parent process ID in the comma-separated list ppid. -s sid Restrict matches to processes with a session ID in the comma-separated list sid. The value zero is taken to mean the session ID of the running pgrep or pkill command. -t tty Restrict matches to processes associated with a terminal in the comma-separated list tty. Terminal names may be specified as a fully qualified path, in the form 'ttyXX', or 'pts/N', (where XX is any pair of letters, and N is a number), or the shortened forms 'XX' or 'N'. A single dash ('-') matches processes not associated with a terminal. -U uid Restrict matches to processes with a real user ID in the comma-separated list uid. -u euid Restrict matches to processes with an effective user ID in the comma-separated list euid. -v Reverse the sense of the matching; display processes that do not match the given criteria. -x Require an exact match of the process name, or argument list if -f is given. The default is to match any substring. -signal A non-negative decimal number or symbolic signal name specifying the signal to be sent instead of the default TERM. This option is valid only when given as the first argument to pkill. The -l flag is also availale for prenice. Note that a running pgrep or pkill process will never consider itself or system processes (kernel threads) as a potential match. EXIT STATUS
pgrep, pkill, and prenice return one of the following values upon exit: 0 One or more processes were matched. 1 No processes were matched. 2 Invalid options were specified on the command line. 3 An internal error occurred. SEE ALSO
grep(1), kill(1), ps(1), kill(2), sigaction(2), re_format(7), signal(7), renice(8) HISTORY
pkill and pgrep first appeared in NetBSD 1.6. They are modelled after utilities of the same name that appeared in Sun Solaris 7. prenice was introduced in NetBSD 6.0. BSD
December 7, 2010 BSD
All times are GMT -4. The time now is 07:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy