How to get all process ids without ps command on Linux

WB Lee picture WB Lee · Oct 2, 2015 · Viewed 16.1k times · Source

How to get all process ids (pid) (similar to: $ ps aux) but without using ps.

Answer

glenn jackman picture glenn jackman · Oct 2, 2015

On Linux, all running process have "metadata" stored in the /proc filesystem.

All running process ids:

shopt -s extglob # assuming bash
(cd /proc && echo +([0-9]))