Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 06:16 AM
05-06-2003 06:16 AM
but not return the grep command?
As in
ps -ef | grep junk
root 6874 1501 0 10:15:33 pts/tb 0:00 grep junk
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 06:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 06:20 AM
05-06-2003 06:20 AM
Re: grep
ps -ef|grep junk |grep -v grep
option -v exclude
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 06:21 AM
05-06-2003 06:21 AM
Re: grep
ps -ef | grep junk | grep -v "grep"
Or, better yet, put this little script called psg in /usr/local/bin:
##########################################################################
# psg - Process Search
# Substitute for "ps -ef|grep" command string.
##########################################################################
case $# in
0) echo "Error: Argument Expected";
exit;
;;
1) ps -ef | grep $1 | grep -v "grep"
# 1) UNIX95= ps -fC $1
;;
*) echo "Error: Only 1 Argument Allowed";
exit;
;;
esac
Then just do "psg junk"
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 06:26 AM
05-06-2003 06:26 AM
Re: grep
One way to do it is like this:
ps -ef | grep [j]unk
But probably the better method is to use the XPG4 implementation of the 'ps' command to look for the actual command by using the '-C' option:
UNIX95=1 ps -fC junk
I like that because it is much cleaner and you don't have to invite grep to the party.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 06:27 AM
05-06-2003 06:27 AM
Re: grep
alias psg='ps -ef | grep -v grep | grep -e PPID -e'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 06:31 AM
05-06-2003 06:31 AM
Re: grep
#!/usr/bin/sh
#
# Program name : psg
# Usage : psg some_pattern
# This program searches through a process status (ps -ef)
# listing for a pattern given as the first command line
# argument
procs=`ps -ef`
head=`echo "$procs" | line`
echo "$head"
echo "$procs" | grep -i $1 | grep -v $0 # Write out lines
# containing $1 but not thisprograms command line name
# Note that $procs MUSt be quoted or the newlines in the ps
# -ef listing will be turned into spaces when echoed. $head
# must also be quoted to preserve any extra whitespace
Lots of ways to get things done with Unix.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 06:54 AM
05-06-2003 06:54 AM
Re: grep
ps -ef | grep junk | grep -v "grep"
sould do