faster bash operations on files with File Descriptors.

2011-06-11 2 min read Bash Learning Linux

I was writing a bash script that would do some operations and read and write to file. Seems that that was pretty simple with

  <td>
    <div class="text codecolorer">
      while read line<br /> <br /> do<br /> <br /> done<file
    </div>
  </td>
</tr>
1
2
3
4
5

and then use redirection operations like “>” and “»” to write to file. Done with the script pretty fast. So far so good, when I went for real life tests, no one was interested in using it, why? Simple, it was simply taking too long. The file was reading about 10K lines and writing about 50 lines and was taking about more than 10 minutes.

Continue reading

Total upload and download on any interface.

2011-06-05 1 min read Bash Fedora

Something that I have been searching for a long time, finally some look inside the <a class=“zem_slink” title=“Procfs” rel=“wikipedia” href=“http://en.wikipedia.org/wiki/Procfs" _mce_href=“http://en.wikipedia.org/wiki/Procfs">/proc got me what I wanted. Hope this will save someone’s day. So far, the only option I could think of was to run conky which becomes a little heave on some of the very old laptops I have to use sometimes 🙁

  <td>
    <div class="text codecolorer">
      &nbsp;cat /proc/net/dev|grep eth2|awk '{print $2/1024/1024"&nbsp; "$10/1024/1024}'
    </div>
  </td>
</tr>
1
Enhanced by Zemanta

10 Useful Sar (Sysstat) Examples for UNIX / Linux Performance Monitoring

2011-04-22 3 min read Learning Linux

10 Useful Sar (Sysstat) Examples for UNIX / Linux Performance Monitoring

by Ramesh Natarajan on March 29, 2011

Using sar you can monitor performance of various Linux subsystems (CPU, Memory, I/O..) in real time.

Using sar, you can also collect all performance data on an on-going basis, store them, and do historical analysis to identify bottlenecks.

Sar is part of the sysstat package.

This article explains how to install and configure sysstat package (which contains sar utility) and explains how to monitor the following Linux performance statistics using sar.

Continue reading

use finch, less memory and cpu usage, in replacement for pidgin.

2011-03-27 1 min read Fedora

Well, if you are on linux then you have options – is a known fact. But how those options help?

I was working on a machine which had very less RAM and was quite old system and it was running F14. Guess what would be the state of the system with pidgin, xmms, firefox, evolution and couple of terminals. Now, this is where if you could save a few cycles of CPU then you can actullay see the difference in sluggish GUI and and an okay sort of GUI. So, first off, kill pidgin and use finch.

Continue reading

top - looks better and is more useful with a rc file...

2010-05-07 1 min read Fedora Learning Linux

top is a very useful command to find out who is eating up the <a class="zem_slink freebase/en/central_processing_unit" title="Central processing unit" rel="wikipedia" href="http://en.wikipedia.org/wiki/Central_processing_unit">CPU or the memory. But sometimes the plain and simple look simply would be boring so how about some fun. Copy the below code to file : ~/.toprc

RCfile for &#8221;top&#8221;
Id:a, Mode_altscr=1, Mode_irixps=0, Delay_time=5.000, Curwin=0
Def    fieldscur=mfcAbdEgHIursOpQTvyzWjKNLX
winflags=32184, sortindx=10, maxtasks=0
summclr=4, msgsclr=5, headclr=5, taskclr=4
Job    fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
winflags=62777, sortindx=0, maxtasks=0
summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem    fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
winflags=62777, sortindx=13, maxtasks=0
summclr=5, msgsclr=5, headclr=4, taskclr=5
Usr    fieldscur=ABDECGfhijlopqrstuvyzMKNWX
winflags=62777, sortindx=4, maxtasks=0
summclr=3, msgsclr=3, headclr=2, taskclr=3

Continue reading
Newer posts