Question

So I am writing a shell script that gets all the current processes running, and pipes them into grep to filter out the ones I need.

But I also need it to give me a timestamp Either when the PS occurs, or when the process was started, it doesnt matter, I just need A time. All the processes just take fractions of seconds.

My command is this:

ps -U USERNAME -o rss=MEM,comm=CMD,pid=PID

I tried going like this:

ps -U USERNAME -o rss=MEM,comm=CMD,pid=PID, start=START

but that just gives me a time like hh:mm:ss. I need something more precise than this. Timestamps are ideal.

Any ideas?

Was it helpful?

Solution

does the following satisfy your need?

date; ps -U USERNAME -o rss=MEM,comm=CMD,pid=PID
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top