/go/top: top from the Command Line

The standard Linux top shows which processes use the most CPU, but not what started them. /go/top adds that. For each of the ten busiest processes, it prints the process ID and the full command of its parent process. This helps you tell, for example, which PHP-FPM master or web server a busy worker belongs to. You can also give it a single process ID to get that process's parent. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# The ten busiest processes and their parents
/go/top

# The parent of one process
/go/top 1234

Options

Argument Required Default Notes
<pid> No The ten busiest processes A process ID (a whole number above 0).

If the argument is not a positive number, the command prints nothing.

Examples

# Top ten processes with their parents
/go/top

# Only the results, without the "not found" lines
/go/top 2>/dev/null

# Find out what started process 2345
/go/top 2345

Output

Each line has the form PID|parent command. The command is the parent’s full command line.

2345|/usr/sbin/php-fpm: master process (/etc/php-fpm.conf)
2411|/usr/sbin/httpd -DFOREGROUND
2790|/usr/lib/systemd/systemd --system --deserialize 31

The lines are in the order of top: highest CPU use first.

When a parent can’t be found, the line is written to the error output instead:

1|(parent process not found or invalid)

Outcome What you get
Parent found `PID
Parent not found `PID
Invalid <pid> No output.

Every run is logged to /var/log/go/top.log with a timestamp and the arguments used.

See the full reference at /go/top and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *