Linux commands: Difference between revisions

Jump to navigation Jump to search
136 bytes added ,  5 October 2023
Line 384: Line 384:


=== System memory usage ===
=== System memory usage ===
Memory usage
==== Obtaining Memory Usage through a WQL Query ====
* {{Win}}:
on {{Win}}:
** namespace: ROOT\CIMV2
* namespace: ROOT\CIMV2
** WQL query: {{kbd | key= SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem}}<ref>[http://www.perlmonks.org/?node_id=882932 Collect Memory Data from WMI (Win32)]</ref>
* WQL query: {{kbd | key= SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem}}<ref>[http://www.perlmonks.org/?node_id=882932 Collect Memory Data from WMI (Win32)]</ref>
** output example: 21683460 ([https://msdn.microsoft.com/zh-tw/library/system.uint64(v=vs.110).aspx UInt64, 64 bit Unsigned Integer]) unit: KB
* output example: 21683460 ([https://msdn.microsoft.com/zh-tw/library/system.uint64(v=vs.110).aspx UInt64, 64 bit Unsigned Integer]) unit: KB
** memory usage = (FreePhysicalMemory * 100) / TotalVisibleMemorySize; unit: %
* memory usage = (FreePhysicalMemory * 100) / TotalVisibleMemorySize; unit: %


* freebsd & {{Linux}}:
==== Obtaining Memory Usage through free command ====
** command: {{kbd | key = free}}
on freebsd & {{Linux}}
** output example:  
* command: {{kbd | key = free}}
* output example:  
<pre>
<pre>
                               total      used      free    shared    buffers    cached
                               total      used      free    shared    buffers    cached
Line 400: Line 401:
                     Swap:      4194300    1219364    2974936
                     Swap:      4194300    1219364    2974936
</pre>
</pre>
** memory usage = 7922496 / 8060416; unit: %
* memory usage = 7922496 / 8060416; unit: %


* {{Mac}} (known as [https://zh.wikipedia.org/zh-tw/Darwin_(%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F) Darwin]):
==== Obtaining Memory Usage through top command ====
** command: {{kbd | key = top -l 1 | grep PhysMem:}}
{{Mac}} (known as [https://zh.wikipedia.org/zh-tw/Darwin_(%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F) Darwin]):
** output example: PhysMem: 8017M used (1486M wired), 172M unused.
* command: {{kbd | key = top -l 1 | grep PhysMem:}}
** memory usage: 172 / (8017+172); unit: %
* output example: PhysMem: 8017M used (1486M wired), 172M unused.
* memory usage: 172 / (8017+172); unit: %


=== System disk space usage  ===
=== System disk space usage  ===
Anonymous user

Navigation menu