change time format for ps time in unix

I am trying to get back the time in the format hh:mm without the seconds, running this:

 ps -p $pid -o time=

gets back (for example) 00:03:19 but I want just (for example) 00:03

I have tried looking at the manual and searched on the net, couldn't find anything that i can understand. Can someone help me please. Thanks in advance.

Upvotes: 1

Views: 1382

Answers (1)

hek2mgl
hek2mgl

Reputation: 157967

ps itself doesn't offer to configure the time format. However, you can pipe to cut:

ps -p $pid -o time= | cut -d: -f1,2

Upvotes: 1

Related Questions