05-12-2011, 02:06 AM #1
How to mimick the "free" command used in Linux in OS X.
- Member Since
- Dec 22, 2010
- Southern California
- Model Name: iMac Model Identifier: iMac11,2 Processor Name: Intel Core i3 Processor Speed: 3
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:
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:
Below I put an example of what the output looks like on my terminal.
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
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By michelangelo in forum Web Design and HostingReplies: 3Last Post: 07-30-2015, 09:47 AM
By markbellaire in forum OS X - Operating SystemReplies: 2Last Post: 04-09-2014, 03:29 PM
By ReelDeal in forum OS X - Apps and GamesReplies: 1Last Post: 12-24-2012, 02:18 PM
By juniorj23 in forum iOS and AppsReplies: 1Last Post: 06-12-2012, 06:39 PM
By trey5498 in forum OS X - Development and DarwinReplies: 3Last Post: 01-25-2012, 02:04 PM