Using the 'ps' command to troubleshoot your website

The affects of Web Hosts on Your Business Website

Here're ways your choice of web hosting service provider impacts the performance of your business:


check

Website loading speed

check

Uptime and availability

check

Customer support

check

Security

check

Server location

Using the ‘ps’ command to troubleshoot your website

Using the ‘ps’ command to troubleshoot your website

SSL Certificate

Overview

To troubleshoot your server, you can use a variety of ‘ps’ commands. After logging into the server through SSH, run these commands in a terminal. For more information, see the following article:

Overview of SSH

The ‘ps’ command

ps is a command you can use to troubleshoot. The ‘ps’ command displays information about your memory and CPU use.

For example, if you’re utilizing a VPS and see that your memory usage has increased from 60MB to 250MB per day, you should investigate what’s going on behind the scenes.

The ‘ps’ commands listed below will help you pinpoint high memory and CPU consumption.

The ‘ps’ commands below must be entered into a shell terminal. For more information, see the SSH article.

The top 10 processes are displayed.
The top ten (10) processes that are utilizing memory are displayed with the following four ‘ps’ commands:

[server]

$ ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 [server] $ ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10

$ ps -eo pcpu,pid,user,args | sort -r -k1 | less or: $ ps -eo pcpu,pid,user,args | less or: $ ps -eo pcpu,pid,user
[server]
$ ps -eo pmem,pid,user,args | sort -k 1 -r | head -10 [server] $ ps -eo pmem,pid,user,args | sort -k 1 -r | head -10
$ sort -r -k1 | less ps -eo pmem,pid,user,args | less ps -eo pmem,pid,user,args | less ps -eo pmem,pid,user,arg
The following command displays USERNAME, CPU%, MEMORY%, and the number of processes now running. On a single line, run the following command:

[server]

awk ‘$ ps aux | awk ‘$ ps aux | awk ‘$

cpu[$1]+=$3; mem[$1]+=$4; procs[$1]+=1; cpu[$1]+=$3; mem[$1]+=$4; procs[$1]+=1 END for (user in cpu) print
Displaying memory usage with /proc/meminfo

user,”cpu:,”cpu[user],”mem:,”mem[user],”proc:,”procs[user] ‘ /proc/meminfo
[server]
—sort pmem $ ps aux
To see memory use over time, run the following command (you must repeat the command or use a cron job):

[server]

—pid=$ ps ev

[EnterPID]
Use the following ‘ps’ command to see a list of all currently active processes as well as comprehensive information:

[server]

on most systems: $ ps -ef

[server]

You can identify a memory leak by running: $ ps -aux

[server]

—pid=$ ps ev

[HighestEnterPID]