System Administration & Network Administration
ubuntu grep command-line-interface
Updated Sat, 20 Aug 2022 00:21:29 GMT

Ubuntu command to constantly monitor a service?


I was curious if anyone new a command like tail or top to constantly monitor a service as it runs. I'm trying to watch sendmail currently to see who is connecting to it, but would like to have it a little more dynamic than just repeatedly typing ps aux | grep send

is there a good way to constantly keep this running? Thanks guys n' gals




Solution

You can use the watch command along with ps -aux to refresh. watch -n 5 "ps -axf |grep send" will run the ps command every 5 seconds (note the quotes).





Comments (2)

  • +0 – Great this is the answer, just waiting for the four minutes to chalk down to accept. Thanks slillibri (sp?) — Dec 05, 2011 at 23:25  
  • +1 – I have an alternative use for watch, which is the nastiest hackiest continuous integration ever. watch git pull — Dec 06, 2011 at 00:17