LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   using ps with the u option and custom formatting (https://www.linuxquestions.org/questions/linux-software-2/using-ps-with-the-u-option-and-custom-formatting-729346/)

Leo Simon 05-29-2009 11:15 AM

using ps with the u option and custom formatting
 
This should be trivial, but it's defeated me completely
I want to combine the u option with custom formating, specifically

I have a script that I'm running called doPingY,
Code:

ps aux | grep doPingY | grep -v grep
shows me that the program is running but all I want is the etime
Code:

ps -eo "%c %t"
gives me exactly the format I want, but it doesn't pick up my batch job. To see that I need the u option. But
Code:

ps -euo "%c %t"
produces a conflicting options error

Any advise would be most appreciated!!

MensaWater 05-29-2009 12:25 PM

u requires you to specify a user on the command line. That means for it to work it has to be followed by a user name rather than other flags. Similarly o must be followed by options rather than other flags.

You can still do it but have to separate your flags:

ps -eu <username> -o "%c %t"


All times are GMT -5. The time now is 08:40 PM.