Skip to content

Instantly share code, notes, and snippets.

@littlefuntik
Last active March 14, 2023 23:47
Show Gist options
  • Save littlefuntik/11122ab3535140c84c1b784144b14e37 to your computer and use it in GitHub Desktop.
Save littlefuntik/11122ab3535140c84c1b784144b14e37 to your computer and use it in GitHub Desktop.
Ubuntu/Linux get process memory usage(include child processes)
#!/bin/sh
pmap -x $(ps -fC "$1" | head -n2 | tail -n1 | awk '{print $2}') | tail -n 1 | awk '{print $3/1024 "MB"}'
# example usage:
#
# $ psmem chrome
# 1144.3MB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment