How can i achieve pstree -sup $$ just with ps?

Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
how can i achieve pstree -sup $$ just using ps?
Tried ps h -a -o pid,user,comm= $$ but can't figure it out,
how to get the "process-chain"... Do I need a shell-script for it?
Thx
Johnny
linux command-line ps
add a comment |Â
up vote
-1
down vote
favorite
how can i achieve pstree -sup $$ just using ps?
Tried ps h -a -o pid,user,comm= $$ but can't figure it out,
how to get the "process-chain"... Do I need a shell-script for it?
Thx
Johnny
linux command-line ps
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
how can i achieve pstree -sup $$ just using ps?
Tried ps h -a -o pid,user,comm= $$ but can't figure it out,
how to get the "process-chain"... Do I need a shell-script for it?
Thx
Johnny
linux command-line ps
how can i achieve pstree -sup $$ just using ps?
Tried ps h -a -o pid,user,comm= $$ but can't figure it out,
how to get the "process-chain"... Do I need a shell-script for it?
Thx
Johnny
linux command-line ps
asked Jun 7 at 16:04
Johnny
1
1
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
#!/bin/bash
PID=$(ps -h -o pid $1)
while true;do
user=$(ps h -o user $PID)
cmd=$(ps h -o comm= $PID)
echo -e "$PID t ($cmd,$user)"
[ $PID != 1 ] || break
PID=$(ps h -o ppid $PID);
done;
exit 0
A bit of comments, explanations will make this answer much better
â Romeo Ninov
Jun 8 at 18:18
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
#!/bin/bash
PID=$(ps -h -o pid $1)
while true;do
user=$(ps h -o user $PID)
cmd=$(ps h -o comm= $PID)
echo -e "$PID t ($cmd,$user)"
[ $PID != 1 ] || break
PID=$(ps h -o ppid $PID);
done;
exit 0
A bit of comments, explanations will make this answer much better
â Romeo Ninov
Jun 8 at 18:18
add a comment |Â
up vote
0
down vote
#!/bin/bash
PID=$(ps -h -o pid $1)
while true;do
user=$(ps h -o user $PID)
cmd=$(ps h -o comm= $PID)
echo -e "$PID t ($cmd,$user)"
[ $PID != 1 ] || break
PID=$(ps h -o ppid $PID);
done;
exit 0
A bit of comments, explanations will make this answer much better
â Romeo Ninov
Jun 8 at 18:18
add a comment |Â
up vote
0
down vote
up vote
0
down vote
#!/bin/bash
PID=$(ps -h -o pid $1)
while true;do
user=$(ps h -o user $PID)
cmd=$(ps h -o comm= $PID)
echo -e "$PID t ($cmd,$user)"
[ $PID != 1 ] || break
PID=$(ps h -o ppid $PID);
done;
exit 0
#!/bin/bash
PID=$(ps -h -o pid $1)
while true;do
user=$(ps h -o user $PID)
cmd=$(ps h -o comm= $PID)
echo -e "$PID t ($cmd,$user)"
[ $PID != 1 ] || break
PID=$(ps h -o ppid $PID);
done;
exit 0
edited Jun 8 at 18:17
Communityâ¦
1
1
answered Jun 8 at 16:55
JohnnyPanic
1
1
A bit of comments, explanations will make this answer much better
â Romeo Ninov
Jun 8 at 18:18
add a comment |Â
A bit of comments, explanations will make this answer much better
â Romeo Ninov
Jun 8 at 18:18
A bit of comments, explanations will make this answer much better
â Romeo Ninov
Jun 8 at 18:18
A bit of comments, explanations will make this answer much better
â Romeo Ninov
Jun 8 at 18:18
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448461%2fhow-can-i-achieve-pstree-sup-just-with-ps%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password