Skip to content

Instantly share code, notes, and snippets.

@andrewh
Last active December 17, 2015 06:48
Show Gist options
  • Save andrewh/5567668 to your computer and use it in GitHub Desktop.
Save andrewh/5567668 to your computer and use it in GitHub Desktop.
Useful ps commands
# Tested on Ubuntu 12.04
#
# Prints full commands, with environment, with wrapping
ps -efww ef
# Prints all commands with CPU and memory usage, sorted by memory in ascending order
ps -eo cmd,%cpu,%mem --sort +%mem
# Same with descending order
ps -eo cmd,%cpu,%mem --sort -%mem
# Prints all commands with pid and thread count, sorted by thread count
ps -eo cmd,pid,thcount --sort thcount
# How long have python processes been running?
ps -C python -o cmd,etime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment