I\'ve tried top | grep skype for example but it doesn\'t work. I\'m trying to find a specific process by name.
On Linux, the top command supports the -p option to monitor specific PIDs. On MacOS, the -p option is called -pid instead.
# Get the PID of the process
pgrep Skype
# Then
top -pid
# Or more succinctly:
top -pid `pgrep Skype`
If you do this a lot, you could turn this into a function and add it to ~/.bash_profile:
# Add this to ~/.bash_profile
function topgrep() {
if [[ $# -ne 1 ]]; then
echo "Usage: topgrep "
else
top -pid `pgrep $1`
fi
}
Now you can simply use topgrep Skype instead, which will run like usual but it will only show the process(es) matching expression.