If you have ever used watch, you know why I am writing about it. It;s a simple command that runs a command over and over again. This may not seem to exciting, but it can help with troubleshooting. For instance, let's use it to monitor filesystem usage. Try this out:
watch -d df
This command will highlight the differences that occur during each interval. This is example, though simplistic, could be used for all kinds of applications. Let's say you were trying to track an application with a memory leak. You could try this:
watch -d "ps -eo pid,rss,vsz,comm --sort=vsz | tail"
Now, is this a perfect solution? No. But it provides a good starting point and hopefully gives you some ideas on how you might use this command.
watch -d df
This command will highlight the differences that occur during each interval. This is example, though simplistic, could be used for all kinds of applications. Let's say you were trying to track an application with a memory leak. You could try this:
watch -d "ps -eo pid,rss,vsz,comm --sort=vsz | tail"
Now, is this a perfect solution? No. But it provides a good starting point and hopefully gives you some ideas on how you might use this command.
Comments
Post a Comment