Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Computing Products:
macOS - Apps and Programs
How to mimick the "free" command used in Linux in OS X.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="unixdude45" data-source="post: 1233971" data-attributes="member: 183160"><p>I have a lot of friends who started out learning about unix command line concepts using linux. And many of them are now migrating over to Mac OS X. They are used to using the "free" command to look up ram/memory statistics using terminal in linux. </p><p></p><p>I found a python script written for Mac OS X that sort of mimics this command. I normally just use "top", or "vmstat" command myself. However, this is a pretty cool little python script and might be handy in someones OS X terminal toolbox out there. </p><p></p><p>I have attached the script. Feel free to tweak it, modify it. Share with us any improvements you can muster. Have fun!</p><p></p><p>Just download the program attachment. I called it free.py.txt</p><p>Now be sure to "cd" into the directory that the new free.py file is at.</p><p>For example I placed the file in my Documents2 directory so to get there just enter at the terminal:</p><p></p><p><img src="/mac_images/images/smilies/Money-Mouth.png" class="smilie" loading="lazy" alt=":$" title="Money Mouth :$" data-shortname=":$" /> cd /Documents2</p><p></p><p>Now you need to change the name to "free.py" to make it usable by the built in python interpreter by using the "mv" command in your terminal:</p><p><img src="/mac_images/images/smilies/Money-Mouth.png" class="smilie" loading="lazy" alt=":$" title="Money Mouth :$" data-shortname=":$" /> sudo mv free.py.txt free.py</p><p></p><p>Then make it executable by entering:</p><p></p><p><img src="/mac_images/images/smilies/Money-Mouth.png" class="smilie" loading="lazy" alt=":$" title="Money Mouth :$" data-shortname=":$" /> chmod +x free.py</p><p></p><p> Now type the following command in your terminal:</p><p></p><p><img src="/mac_images/images/smilies/Money-Mouth.png" class="smilie" loading="lazy" alt=":$" title="Money Mouth :$" data-shortname=":$" /> python free.py</p><p></p><p>Below I put an example of what the output looks like on my terminal. </p><p></p><p>Enjoy!</p><p></p><p>raul-ruizs-imac:documents2 ruizfamily$ python free.py</p><p>Wired Memory: 311 MB</p><p>Active Memory: 555 MB</p><p>Inactive Memory: 387 MB</p><p>Free Memory: 2525 MB</p><p>Real Mem Total (ps): 596.910 MB</p><p></p><p>[ATTACH=full]15010[/ATTACH]</p></blockquote><p></p>
[QUOTE="unixdude45, post: 1233971, member: 183160"] I have a lot of friends who started out learning about unix command line concepts using linux. And many of them are now migrating over to Mac OS X. They are used to using the "free" command to look up ram/memory statistics using terminal in linux. I found a python script written for Mac OS X that sort of mimics this command. I normally just use "top", or "vmstat" command myself. However, this is a pretty cool little python script and might be handy in someones OS X terminal toolbox out there. I have attached the script. Feel free to tweak it, modify it. Share with us any improvements you can muster. Have fun! Just download the program attachment. I called it free.py.txt Now be sure to "cd" into the directory that the new free.py file is at. For example I placed the file in my Documents2 directory so to get there just enter at the terminal: :$ cd /Documents2 Now you need to change the name to "free.py" to make it usable by the built in python interpreter by using the "mv" command in your terminal: :$ sudo mv free.py.txt free.py Then make it executable by entering: :$ chmod +x free.py Now type the following command in your terminal: :$ python free.py Below I put an example of what the output looks like on my terminal. Enjoy! raul-ruizs-imac:documents2 ruizfamily$ python free.py Wired Memory: 311 MB Active Memory: 555 MB Inactive Memory: 387 MB Free Memory: 2525 MB Real Mem Total (ps): 596.910 MB [ATTACH=full]15010[/ATTACH] [/QUOTE]
Verification
Name this item 🌈
Post reply
Forums
Apple Computing Products:
macOS - Apps and Programs
How to mimick the "free" command used in Linux in OS X.
Top