Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread Paul Macdonald

 On 18/08/2010 16:18, Aleksandr Miroslav wrote:

hello,

I am looking for something on BSD that will give me the same info as
free(1) in Linux. i.e. I would like to know the state of total/used/free
memory and swap.

I know there are a number of utilities in ports that will let me do
this, I am however looking for something in the base system (if such a
utility exists).

I also know that top(1) gives this info, and I could certainly use that,
I just wanted the nearest BSD sibling of free(1).)

Thank you!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


ralf engelschall wrote a nice perl script which does this


http://people.freebsd.org/~rse/dist/

(the free-memory script)

Paul.

--
-
Paul Macdonald
IFDNRG Ltd
Web and video hosting
-
t: 0131 5548070
m: 07534206249
e: p...@ifdnrg.com
w: http://www.ifdnrg.com
-
IFDNRG
40 Maritime Street
Edinburgh
EH6 6SA
-

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread Chris Maness
On Wed, Aug 18, 2010 at 8:18 AM, Aleksandr Miroslav
alexmiros...@gmail.com wrote:
 hello,

 I am looking for something on BSD that will give me the same info as
 free(1) in Linux. i.e. I would like to know the state of total/used/free
 memory and swap.

 I know there are a number of utilities in ports that will let me do
 this, I am however looking for something in the base system (if such a
 utility exists).

 I also know that top(1) gives this info, and I could certainly use that,
 I just wanted the nearest BSD sibling of free(1).)

 Thank you!
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Would not the info displayed in the command top suffice?

Regards,
Chris Maness
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread RW
On Wed, 18 Aug 2010 11:18:58 -0400
Aleksandr Miroslav alexmiros...@gmail.com wrote:

 hello,
 
 I am looking for something on BSD that will give me the same info as
 free(1) in Linux. i.e. I would like to know the state of
 total/used/free memory and swap.
 
 I know there are a number of utilities in ports that will let me do
 this, I am however looking for something in the base system (if such a
 utility exists).
 
 I also know that top(1) gives this info, and I could certainly use
 that, I just wanted the nearest BSD sibling of free(1).)
 

Is there any particular reason you want to know? Free memory isn't a
very meaningful concept in FreeBSD.  
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread Aleksandr Miroslav
on wed, aug 18, 2010 at 1:04 pm, chris maness ch...@chrismaness.com wrote:
 Would not the info displayed in the command top suffice?

Yes, top -n 1 does (sort of) display the info I need.

The swap portion gives me the same info as Linux free, the memory
portion is more cryptic, I guess due to differences in how FreeBSD
allocates memory.

Although a BSD free would probably be easier to remember, top -n 1 does the job.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread Aleksandr Miroslav
On Wed, Aug 18, 2010 at 1:41 PM, RW rwmailli...@googlemail.com wrote:
 Is there any particular reason you want to know? Free memory isn't a
 very meaningful concept in FreeBSD.

I have a webserver that had it's Apache killed this morning. The box
itself had been stable for several years, as well as the Apache
instance. The error that I saw in /var/log/messages was something along
the following:

pid 1234 (httpd), uid 100, was killed: out of swap space

So I went to check what was eating up the swap,

The problem itself was tracked down fairly easily, someone had added a
shelt script to cron (/home/user/foo.sh) and had mistakenly put the full
path to the script into the script itself -- essentially creating a
forkbomb.

But while I was in the middle of debugging this and noticed that line
from the logfile, I spent more time than necessary trying to figure out
exactly how much swap/memory was being used, and who was using it.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread Paul Schmehl
--On Wednesday, August 18, 2010 14:14:25 -0400 Aleksandr Miroslav 
alexmiros...@gmail.com wrote:



On Wed, Aug 18, 2010 at 1:41 PM, RW rwmailli...@googlemail.com wrote:

Is there any particular reason you want to know? Free memory isn't a
very meaningful concept in FreeBSD.


I have a webserver that had it's Apache killed this morning. The box
itself had been stable for several years, as well as the Apache
instance. The error that I saw in /var/log/messages was something along
the following:

pid 1234 (httpd), uid 100, was killed: out of swap space

So I went to check what was eating up the swap,

The problem itself was tracked down fairly easily, someone had added a
shelt script to cron (/home/user/foo.sh) and had mistakenly put the full
path to the script into the script itself -- essentially creating a
forkbomb.

But while I was in the middle of debugging this and noticed that line
from the logfile, I spent more time than necessary trying to figure out
exactly how much swap/memory was being used, and who was using it.


man (8) pstat

pstat -s -m
Device  1M-blocks UsedAvail Capacity
/dev/ad8s1b  81920 8191 0%

--
Paul Schmehl, Senior Infosec Analyst
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
***
It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead. Thomas Jefferson

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread Mike Jeays
On August 18, 2010 02:06:08 pm Aleksandr Miroslav wrote:
 on wed, aug 18, 2010 at 1:04 pm, chris maness ch...@chrismaness.com wrote:
  Would not the info displayed in the command top suffice?
 
 Yes, top -n 1 does (sort of) display the info I need.
 
 The swap portion gives me the same info as Linux free, the memory
 portion is more cryptic, I guess due to differences in how FreeBSD
 allocates memory.
 
 Although a BSD free would probably be easier to remember, top -n 1 does the
 job. ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
 freebsd-questions-unsubscr...@freebsd.org

alias free='top -n 1 '  ?!
-- 
http://www.jeays.ca
http://www.rotarycpmm.ca
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread Jason

On Wed, Aug 18, 2010 at 05:08:35PM -0400, Mike Jeays thus spake:

On August 18, 2010 02:06:08 pm Aleksandr Miroslav wrote:

on wed, aug 18, 2010 at 1:04 pm, chris maness ch...@chrismaness.com wrote:
 Would not the info displayed in the command top suffice?

Yes, top -n 1 does (sort of) display the info I need.

The swap portion gives me the same info as Linux free, the memory
portion is more cryptic, I guess due to differences in how FreeBSD
allocates memory.

Although a BSD free would probably be easier to remember, top -n 1 does the
job. ___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org


alias free='top -n 1 '  ?!

Even better :) ???

top -n 0|egrep '(Mem|Swap)'|xargs


--
http://www.jeays.ca
http://www.rotarycpmm.ca
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BSD equivalent of Linux's free(1)?

2010-08-18 Thread Depo Catcher



On 8/18/2010 1:06 PM, Aleksandr Miroslav wrote:

on wed, aug 18, 2010 at 1:04 pm, chris manessch...@chrismaness.com  wrote:

Would not the info displayed in the command top suffice?

Yes, top -n 1 does (sort of) display the info I need.

The swap portion gives me the same info as Linux free, the memory
portion is more cryptic, I guess due to differences in how FreeBSD
allocates memory.

Although a BSD free would probably be easier to remember, top -n 1 does the job.




You could create a shell alias for it.
In bash: a
alias free='top -n 1'
put that in your profile so you have it on login.

Also there is a port:
   /usr/ports/sysutils/freecolor

Works just like the free linux command; but has fancy colors. :)
Again, you can alias that to free if you want.



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org