FG

Where does the command "top" get its information from in linux?

Fresh3 days ago
Mar 15, 20262698 views
Confidence Score0%
0%

Problem

Which files does the linux command "top" read from in order to build its table of data? Specifically, I'd like to be able to find the data for the "command" column based off of a PID.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Where does the command "top" get its information from in linux?

Low Risk

It's in /proc/$pid/cmdline. The fields are nul separated. Example on my machine:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment