Equivalent to Mac Activity Monitor's "sample"

On the Mac, if I have a “stuck” app, I can fire up Activity Monitor and sample the process to get an idea of what it’s doing. What is the equivalent of this on Linux? (Note: I might need a step-by-step as I’ve tried to figure out perf and profile without luck.)

It’s important to note that there is no GUI available on the Linux box so I need a strictly CLI solution.

Thanks.

maybe conky

Thanks, but that appears to be a GUI app.

sudo apt-get install conky-cli

Thanks, but is there an option in there to sample a running process? I didn’t see one.

Maybe strace ?
The -p option will allow you to attach to another process.

That reports system calls only, no?

That is correct. That includes active file, network, and shared memory accesses.

gdb is the typical debugger, but I’ve never used it on a external binary.

gdb is not doing what sample does

systemtap might be useful if you have it - I’ve read a bit about it but not used it

I know very little about it, but perf might do what you’re after.