{"id":450,"date":"2024-04-27T14:37:42","date_gmt":"2024-04-27T14:37:42","guid":{"rendered":"https:\/\/webhostingpune.co.in\/blog\/?p=450"},"modified":"2024-04-27T14:48:22","modified_gmt":"2024-04-27T14:48:22","slug":"how-to-check-vps-ram-usage-via-ssh","status":"publish","type":"post","link":"https:\/\/webhostingpune.co.in\/blog\/how-to-check-vps-ram-usage-via-ssh\/","title":{"rendered":"How to Check VPS RAM Usage via SSH"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">To Check VPS RAM Usage via SSH, you can use various command-line tools available in Linux. Checking the RAM usage of your <a href=\"https:\/\/www.webhostingpune.co.in\/vps-hosting\/\">Virtual Private Server<\/a> (VPS) via SSH is a common task for system administrators. Here&#8217;s a step-by-step guide to help you do that:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Check Overall VPS RAM Usage<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<code>free<\/code>&nbsp;command displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;re logged into your VPS via SSH, you can check the overall RAM usage using the <code>free<\/code> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>free -m<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This command will display memory usage statistics in megabytes (MB). You&#8217;ll see output similar to this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"138\" src=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-5.png\" alt=\"VPS RAM Usage\" class=\"wp-image-454\" srcset=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-5.png 900w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-5-300x46.png 300w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Here, &#8220;total&#8221; represents the total amount of RAM, &#8220;used&#8221; represents the amount of RAM currently in use, and &#8220;free&#8221; represents the amount of RAM currently available for use.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you add&nbsp;<strong>-m<\/strong>&nbsp;or&nbsp;<strong>-g<\/strong>&nbsp;after the command, you will get the stats displayed in MB or GB correspondingly. In the modern versions of the free tool you can also use&nbsp;<strong>-h,<\/strong>&nbsp;and the tool will automatically use the most convenient units, like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"666\" height=\"58\" src=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/vps_memory_5.png\" alt=\"\" class=\"wp-image-460\" srcset=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/vps_memory_5.png 666w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/vps_memory_5-300x26.png 300w\" sizes=\"auto, (max-width: 666px) 100vw, 666px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Check Process-Specific RAM Usage<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to check the RAM usage of specific processes, you can use the <code>top<\/code> command. The&nbsp;<code>top<\/code>&nbsp;command provides an interactive real-time view of system processes and their resource usage, including memory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Type&nbsp;<code>top<\/code>&nbsp;in your SSH terminal and press Enter.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>top<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This command will display a dynamic view of system processes, including their CPU and memory usage. Press <code>Shift + M<\/code> to sort processes by memory usage, with the highest memory-consuming processes listed at the top.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"131\" src=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-6-1024x131.png\" alt=\"\" class=\"wp-image-463\" srcset=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-6-1024x131.png 1024w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-6-300x38.png 300w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-6.png 1132w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Use <code>htop<\/code> for a More User-Friendly Interface<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Alternatively, you can use <code>htop<\/code>, a more user-friendly alternative to <code>top<\/code>. Install it if it&#8217;s not already available on your system, and then run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>htop<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This command presents system metrics in a colorized and interactive format, making it easier to interpret than <code>top<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Check RAM Usage Trends<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The\u00a0<code>vmstat<\/code>\u00a0command reports information about processes, memory, paging, block IO, traps, and CPU activity. To monitor RAM usage trends over time, you can use tool <code>vmstat<\/code>. These tools provide historical data on system resource usage, allowing you to identify patterns and potential issues. Here is an example of the output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"963\" height=\"128\" src=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-8.png\" alt=\"\" class=\"wp-image-468\" srcset=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-8.png 963w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2024\/04\/image-8-300x40.png 300w\" sizes=\"auto, (max-width: 963px) 100vw, 963px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The first two lines provide the information on the organization of the table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Procs<\/strong>&nbsp;shows information about processes:&nbsp;<strong>r<\/strong>&nbsp;means the number of processes running or waiting for run time,&nbsp;<strong>b<\/strong>&nbsp;means processes sleeping.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Memory<\/strong>&nbsp;section:&nbsp;<strong>swpd<\/strong>&nbsp;shows virtual memory used,&nbsp;<strong>free<\/strong>&nbsp;shows idle memory,&nbsp;<strong>buff<\/strong>&nbsp;and&nbsp;<strong>cache<\/strong>&nbsp;display memory allocated to buffers and cache correspondingly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two values in the&nbsp;<strong>swap<\/strong>&nbsp;section display amounts of data swapped to (<strong>si<\/strong>) and from (<strong>so<\/strong>) disk per second. Two values in the&nbsp;<strong>IO<\/strong>&nbsp;section show Input\/Output stats for the drive: received from (<strong>bi<\/strong>) and sent to (<strong>bo<\/strong>) it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the&nbsp;<strong>system<\/strong>&nbsp;section&nbsp;<strong>in<\/strong>&nbsp;stands for interrupts per second, and&nbsp;<strong>cs&nbsp;<\/strong>is the abbreviation for context switches.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>CPU<\/strong>&nbsp;shows percentages of processor usage:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>us:<\/strong>\u00a0usage by user-launched code as opposed to system processes.<br><strong>sy:<\/strong>\u00a0usage by the actual system kernel<br><strong>id:<\/strong>\u00a0idle CPU time<br><strong>wa:<\/strong>\u00a0time spent waiting for Input\/Output<br><strong>st:<\/strong>\u00a0time stolen from a <a href=\"https:\/\/www.squarebrothers.com\/vps-hosting-india\/\" data-type=\"link\" data-id=\"https:\/\/www.squarebrothers.com\/vps-hosting-india\/\" target=\"_blank\" rel=\"noopener\">virtual machine<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To Check VPS RAM Usage via SSH, you can use various command-line tools available in Linux. Checking the RAM usage of your Virtual Private Server (VPS) via SSH is a common task for system administrators. Here&#8217;s a step-by-step guide to help you do that: Check Overall VPS RAM Usage The&nbsp;free&nbsp;command displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. Once you&#8217;re logged into your VPS via SSH, you can check the overall RAM usage using the free command: This command will display memory usage statistics in megabytes (MB). You&#8217;ll see output similar to this: Here, &#8220;total&#8221; represents the total amount of RAM, &#8220;used&#8221; represents the amount of RAM currently in use, and &#8220;free&#8221; represents the amount of RAM currently available for use. If you add&nbsp;-m&nbsp;or&nbsp;-g&nbsp;after the command, you will get the stats displayed in MB or GB correspondingly. In the modern versions of the free tool you can also use&nbsp;-h,&nbsp;and the tool will automatically use the most convenient units, like this: Check Process-Specific RAM Usage If you want to check the RAM usage of specific processes, you can use the top command. The&nbsp;top&nbsp;command provides an interactive real-time view of system processes and their resource usage, including memory. Type&nbsp;top&nbsp;in your SSH terminal and press Enter. This command will display a dynamic view of system processes, including their CPU and memory usage. Press Shift + M to sort processes by memory usage, with the highest memory-consuming processes listed at the top. Use htop for a More User-Friendly Interface Alternatively, you can use htop, a more user-friendly alternative to top. Install it if it&#8217;s not already available on your system, and then run: This command presents system metrics in a colorized and interactive format, making it easier to interpret than top. Check RAM Usage Trends The\u00a0vmstat\u00a0command reports information about processes, memory, paging, block IO, traps, and CPU activity. To monitor RAM usage trends over time, you can use tool vmstat. These tools provide historical data on system resource usage, allowing you to identify patterns and potential issues. Here is an example of the output: The first two lines provide the information on the organization of the table. Procs&nbsp;shows information about processes:&nbsp;r&nbsp;means the number of processes running or waiting for run time,&nbsp;b&nbsp;means processes sleeping. Memory&nbsp;section:&nbsp;swpd&nbsp;shows virtual memory used,&nbsp;free&nbsp;shows idle memory,&nbsp;buff&nbsp;and&nbsp;cache&nbsp;display memory allocated to buffers and cache correspondingly. Two values in the&nbsp;swap&nbsp;section display amounts of data swapped to (si) and from (so) disk per second. Two values in the&nbsp;IO&nbsp;section show Input\/Output stats for the drive: received from (bi) and sent to (bo) it. In the&nbsp;system&nbsp;section&nbsp;in&nbsp;stands for interrupts per second, and&nbsp;cs&nbsp;is the abbreviation for context switches. CPU&nbsp;shows percentages of processor usage: us:\u00a0usage by user-launched code as opposed to system processes.sy:\u00a0usage by the actual system kernelid:\u00a0idle CPU timewa:\u00a0time spent waiting for Input\/Outputst:\u00a0time stolen from a virtual machine.<\/p>\n","protected":false},"author":2,"featured_media":475,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[18,21],"tags":[17,22,16],"class_list":["post-450","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command","category-information","tag-command","tag-information","tag-linux"],"_links":{"self":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/comments?post=450"}],"version-history":[{"count":11,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/450\/revisions"}],"predecessor-version":[{"id":474,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/450\/revisions\/474"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/media\/475"}],"wp:attachment":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/media?parent=450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/categories?post=450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/tags?post=450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}