LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2010, 05:43 AM   #1
parunachalam
LQ Newbie
 
Registered: Jan 2010
Posts: 3

Rep: Reputation: 0
What is the Linux equivalant commands of Solaris' prstat & ptree?


Hi Folks,
Could someone advise the solaris' equivalant commands of prstat & ptree in Linux flavour.

Thanks for your time !

Arun
 
Old 02-04-2010, 11:10 AM   #2
slacker_et
Member
 
Registered: Dec 2009
Distribution: Slackware
Posts: 113

Rep: Reputation: 23
I believe the Linux commands you are looking for are top and pstree.

--ET
 
Old 12-08-2011, 07:25 PM   #3
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 256

Rep: Reputation: 101Reputation: 101
[Just discovered this great forum]

I found the ps -H option useful,
but missed the Solaris filter options, so had to add it.
Here is my ptree for Linux:

#!/bin/sh
# Solaris style ptree
# by Michael Tosch

[ -x /usr/bin/ptree ] && exec /usr/bin/ptree "$@"

# Print process tree
# $1 = PID : extract tree for this process
# $1 = user : filter for this (existing) user
# $1 = user $2 = PID : do both

PATH=/bin:/usr/bin:/usr/sbin:/sbin
export PATH

psopt="-e"
case $1 in
[a-z]*) psopt="-u $1";shift;;
esac

[ -z "$1" ] &&
exec ps $psopt -Ho pid=,args=

#some effort to add less to the ps list
tmp=/tmp/ptree.$$
trap 'rm $tmp' 0 HUP INT TERM
ps $psopt -Ho pid=,args= >$tmp
<$tmp awk '
{ ci=index(substr($0,7),$2); o[ci]=$0 }
ci>s[a] { s[++a]=ci }
$1==pid {
for(i=1;i<=a;i++) {
si=s[i]; if(si<=ci) print o[si]
}
walkdown=ci
next
}
ci<walkdown { exit }
walkdown!=0 { print }
' pid="$1"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Solaris Commands help madcatver1 Solaris / OpenSolaris 4 01-30-2008 03:26 AM
implement ptree using bash blizunt7 Fedora 1 01-20-2006 06:18 PM
need commands in Solaris Uday123 Solaris / OpenSolaris 4 12-16-2005 01:55 PM
ptree equavelent on linux raees Linux - Software 6 04-16-2004 11:38 AM


All times are GMT -5. The time now is 03:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration