Unix Commands

From Wiki

Contents

Check server memory allocation

To figure out where the server RAM is being used you can run the command:

ps -aux --sort 'rss'



That will give you a process list sorted by memory usage. The RSS column shows you how much memory in kilobytes is being used by each process. If you total all those together you'll get how much RAM you are actualy using.


Check server performance

This is a great tool to check how your server performes while a certain file is beeing requested by multiple users and multiple times.


We will simulate 5 users concurrently requesting a very light script:
at ab -n 10  -c 5 -v  -A http://www.yourdomain.com/directory/filename.cgi . 
Each simulated user makes 1 requests.

The results are:
  Document Path:          /perl/access/access.cgi
  Document Length:        16 bytes


  Concurrency Level:      10
  Time taken for tests:   1.683 seconds
  Complete requests:      100
  Failed requests:        0
  Total transferred:      16100 bytes
  HTML transferred:       1600 bytes
  Requests per second:    59.42
  Transfer rate:          9.57 kb/s received

  Connnection Times (ms)
                min   avg   max
  Connect:        0    29   101
  Processing:    77   124  1259
  Total:         77   153  1360


The only numbers we really care about are:
  Complete requests:      100
  Failed requests:        0
  Requests per second:    59.42

Check the daily backup

To check if a backup drive is working or not on a particular domain do the following:

1)  Login to the server the site is hosted on with SSH (could use Putty).

2)  type - cd /backup/

3)  type - ls -alh

Reset Server Time

If the server time is off by a few minuters, use this to reset it

rdate -s timeserver.fastdns.net

Check the Server Load

Server load should not be higher then 6. The first number is the current, the second is 10 minutes ago and the third is 30 minutes ago

1)  Login to the server with SSH (Could use Putty) using user root.

2)  Type w and enter.

OR

1)  Login to the server with SSH (Could use Putty) using user root.

2)  Type top and enter.

3)  Click Shift and M to sort by memory usage.

Check what site # belongs to a specific site

Sometimes you will need to know what is the site # for a particular domain.

1)  Login to the server with SSH (Could use Putty) using user root.

2)  Type sitelookup -a |grep furn (where furn will give you the site number for the site that has the word furn in it).

Google