Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • How can I use free command for a particular pid like the top command I used above? Commented Feb 3, 2022 at 4:58
  • @InQusitive, your top command didn't actually get the memory for a specific pid. I mean, it was, but then your grep/awk were only showing the system general memory usage, not the pid's memory usage. I'll add to my answer next week, but for now know you can use ps (for instace: ps -o rss -p <pid>) or pidstat (for instance: pidstar -r -p <pid>). Read their respective man pages for more information. You can also find memory stats in /proc/[pid]/status. Commented Feb 3, 2022 at 16:10
  • @InQusitive actually, it's better you open a new question on how to check process's memory usage in Linux, and show what field from top command you want to show, since this is a different question. Again, just remember that your current full command shows the system's general usage and not the process', so instead of using the command with grep/awk, just show the full top output and say which field you want to easily get for the process. Commented Feb 3, 2022 at 16:15
  • I used the /proc/[pid]/status and it's working good. Commented Feb 4, 2022 at 11:25