I'd like to sort this output by lstart
(start of process):
ps -eo lstart,pid,cmd
Is there a way to output lstart in ISO format like YYYY-MM-DD HH:MM:SS?
But sorting alone does not solve it. I really would like to have ISO date format.
datepsshell
I'd like to sort this output by lstart
(start of process):
ps -eo lstart,pid,cmd
Is there a way to output lstart in ISO format like YYYY-MM-DD HH:MM:SS?
But sorting alone does not solve it. I really would like to have ISO date format.
Best Answer
With
awk
+date
cooperation:Alternative approach using ps
etimes
keyword(elapsed time since the process was started, in seconds):date -d -"$1"seconds
- difference between the current timestamp andelapsed
time, will give the timestamp value of the process