Check out all the colors on you X window system.

2012-02-24 1 min read Fedora

If you ever wondered what combination of some colors would look like but did not really feel like setting them in your xterm just to check them out. Or if you wanted to know about all the colors on you X window system then you can install this utility called xcolorsel.

[xcolorsel][1]
xcolorsel

You will need to setup the rpm-shere repo for this.

Continue reading

BASH Script Performace

2012-01-06 2 min read Bash Learning

Today we will look at some bash code snippests and the performance issues. Lets first look at the problem and the implemented solution:

Problem: We needed to log the output of the ps command for all the process’s. This was required to be done on per minute basis and the output was required in comma separated files. So, here is what was implemented:

pslog=`ps -e -opid,ppid,user,nlwp,pmem,vsz,rss,s,time,stime,pri,nice,pcp:u,args|grep -v PID|sort -r -k 13,13`
        OLD_IFS=$IFS
        IFS=$'\n'
        logarr=( $pslog )
        for LOGLINE in ${logarr[@]}
        do
                LOGLINE=`echo $LOGLINE|awk '{OFS=",";print $1,$2,$3,$4,$5,$6,$7,:$8,$9,$10,$11,$12,$13,$14}'`
                echo $LOGLINE >> output
        done
        IFS=$OLD_IFS

This was working well and there were no issues. But suddenly we started seeing issues with the reported CPU usages. We would see that whenever this script was running the CPU usage was high, specially if there were too many process’s/thread’s on the system during that time.  This code was definitely part of a very large code base, and at this point of time we did not know what was causing the issues.

Continue reading

Rekursive Grep on Solaris or AIX Systems without GNU egrep -r funcionality

2011-12-16 1 min read Learning Solaris

If you work regularly on a Solaris or systems which do not have the “-r” (recursive grep) for grep, then you know what a lifesaver this command can be.

Here is one from command line fu:

find . -type f -exec awk '/linux/ { printf "%s %s: %s\n", FILENAME, NR, $0; }' {} \;

The benefit of using awk here is that you can print the line number also 🙂

Continue reading

Add ssh key to remote host

2011-11-15 3 min read Bash Learning Linux Solaris

Example of tunnelling an X11 application over SSH
Image via Wikipedia

If you are working on recent versions of the *nix OS like Fedora or Ubuntu then you would know about the commad ssh-copy-id. But if you land up using one of the older versions like Solaris or something where the command is not present, then probably you need a simpler solution to this. One of the simplest solution is with a lot of assumtions, simply copy the id_rsa file to remote server and hope it works. And here is  a script to do just that:

Continue reading

Solaris dump analysis

2011-05-18 1 min read Solaris

I had to debug a solaris crash dump and had no ides. Google search wasn’t much useful until finally I found this article:

http://cuddletech.com/blog/?p+AD0-448

have a look at this article, this suggests how to debug the core and find the offending process and root cause of the core in case of kernel panic.

Enhanced by Zemanta

install all solaris software from http

2011-02-23 1 min read Solaris

If you are behind a firewall and install some software like top or wget then you can not use sunfreeware, and why because ftp is blocked. Now that is not the case any more, you can go the http mirror site of sunfreeware and here is the link for the same

http://ftp.sunfreeware.com/ftp/pub/freeware/i386/5.10/

Note: you just need to change the words in bold for sparc or i386 and version of the solaris.

Continue reading
Older posts