Commands to troubleshoot your websites

There could be several reasons a website is not responding as quickly as it should. This article details a few command line tools you can use to troubleshoot your website and webserver. All commands below must be ran on the server via SSH


The command 'uptime' checks the current server load and how long the server has been up and running. The load should most often stay in single digits, but a spike is not uncommon. For example:

[server]$ uptime
11:29:09 up 557 days, 12:30,  2 users,  load average: 2.25, 2.49, 2.62

This shows the following:

  • Time the command was ran
  • How many days the server has been up
  • How many users are logged in (this is 2, you and 'root')
  • Load average for past 1, 5, and 15 minutes

What you're looking for is the load 'over time', not necessarily the load at a single instant.


The ‘top’ command allows you to view system tasks running in real-time. View the following article for examples on how to use this command:


Assuming you’re running a PHP site, run the following command. If you’re not using PHP, just change the ‘grep php’ section to the language you’re using:

Change the following when you run the command:

  • youruser — change to your SSH username
  • php — change to the process type you're looking for
[server]$ lsof -u youruser | grep php | grep /home
php56.cgi 14963 youruser  cwd       DIR   8,17      4096 15115680565 /home/youruseruser/

Ignore any errors you see in the response. What you’re looking for is the list of open files for your PHP processes. You can then look closer into those files to see what the issue may be.

Troubleshooting the 'lsof' command

One problem with running 'lsof' is that there may be no useful output to work with when you run it once. The following example uses the 'watch' command to run the 'lsof' command every two seconds while outputting the results to a file named 'results.txt'.

[server]$  watch "lsof -u youruser | grep php | grep /home | tee -a results.txt"

You can see the live output in your terminal as this runs. When you're finished, click Ctrl + C to stop it. You can then view the full output in the results.txt file by running the following command:

[server]$ cat results.txt

If there is nothing in the 'results.txt' file, run it again. Keep running it until you have a line of output that shows which domain or file is currently being used.


The 'ps' command displays a snapshot of running processes on the server. View the following article for examples on how to use this command:

Examine your access.log file

Every DreamHost website stores access.log information about the site. These logs can become very large and difficult to read, so there are a few commands you can run to quickly tell which site is getting the most traffic. View the following article for further details:

Did this article answer your questions?

Article last updated .