I am trying to have a terminal showing the last 5 processes opened. This is helpful for my debugging.
At this point I have
watch ps -ef --sort=start_time
This works fine but it shows all processes so they don't fit in the screen. How can I limit it to a specific number like 5 or 10?
-- Update --
A have tried
watch "ps -ef --sort=start_time | tail -n 5"
but the problem is that the header of ps
is omitted so after a while I don't know what I am looking at.
watch ps -ef --sort=start_time | head -5
orwatch ps -ef --sort=start_time | tail -5
depending on whether the sort is ascending or not