Live Chat!

Obtain some system statistics from vmstat

* * * * * 1 votos

December 8th, 2007 mysurface

vmstat know as virtual memory statistics reporter, but it gives more information the just only virtual memory.
Besides memory, it covers overall CPU usage, IO, Swap, Proc, System interupts and context switching. vmstat is pretty easy to use, ignores all other options, the normal usage will be looks like this:
vmstat [delay] [counts]
Let say, you want to [...]

Posted in Admin, date, tail, vmstat | Hits: 27570 | 4 Comments »

head and tail

          0 votos

November 1st, 2006 toydi

Given a list of text lines in a file, to display the first 10 lines:
head foo.txt
To display the last 10 lines:
tail foo.txt
Try -n option to specify the number of lines to display:
tail -n3 foo.txt # the last 3 lines
head -n4 foo.txt # the first 4 lines
And don’t forget, the ‘+’ in tail [...]

Posted in Text Manipulation, head, tail | Hits: 4335 | 1 Comment »

I am watching you

* * * * * 1 votos

August 15th, 2006 mysurface

To repeatly watching a certain file, such as log files, you can do that:
watch tail /var/log/messages
By default, this will be refresh every 2 seconds, and tail with list last 10 entries by default too. If you want to have specific refresh rate, you can do so:
watch -n 5 tail /var/log/messages
This will change the refresh rate [...]

Posted in Network, tail, watch | Hits: 3887 | 1 Comment »

log personal message to /var/log/messages

* * * * * 1 votos

August 14th, 2006 mysurface

To log personal messages to /var/log/messages when you write script, you can use logger
simple example:
logger i am testing
And check the result with tail, it display last 10 line of messages by default
tail /var/log/messages
To put more info to log file, you can specified the timestamp with scriptname by this
logger -t `basename $0` i am still testing
basename [...]

Posted in Admin, backquote, logger, tail | Hits: 4827 | 2 Comments »