Installing Full Blin g theme on N900

2011-08-03 1 min read Maemo N900

I was going through the post : http://talk.maemo.org/showthread.php?t=46739
and found the theme quite intruging but not complete to the point where I can download the deb file and install it in /usr/share/theme/ dir with simple commands “apt-get” or at max just use mkdir command to create the dir and dump everything in that dir. So, I wrote this couple of bash one liners to copy the required files to my N900.

Continue reading

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

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

Unix shell script for removing duplicate files

2011-05-16 1 min read Bash Linux

The following shell script finds duplicate (2 or more identical) files and outputs a new shell script containing commented-out rm statements for deleting them (copy-paste from here):

::: updated on 02 May 20121, seems like wordpress did not like it so well so reformatting the code :::::::

#!/bin/bash -
#===============================================================================
#
#          FILE:  a.sh
#
#         USAGE:  ./a.sh
#
#   DESCRIPTION:
#
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR: Amit Agarwal (aka), amit.agarwal@roamware.com
#       COMPANY: blog.amit-agarwal.co.in
#       CREATED: 02/05/12 06:52:08 IST
# Last modified: Wed May 02, 2012  07:03AM
#      REVISION:  ---
#===============================================================================

OUTF=rem-duplicates.sh;
echo "#!/bin/sh" >$OUTF;
find "$@" -type f -exec md5sum {} \; 2>/dev/null | sort --key=1,32 | uniq -w 32 -d |cut -b 1-32 --complement |sed 's/^/rm -f/' >>$OUTF

Pretty good one line, I must say 🙂

Continue reading

Terminating a SSH session after starting background process.

2011-05-14 3 min read Learning Linux

 

This is too good. If you are planning to start a background process in the bash script in the background and continue in the script, you cannot do it until…….

You would need to close the stdout/stdin and stderr before you can terminate any ssh session automatically. Here’s some more light on this topic.

http://lists.debian.org/debian-user/2005/09/msg00254.html

On Thu, Sep 01, 2005 at 05:33:28PM -0400, Roberto C. Sanchez wrote: > I occasionally log into a machine remotely and start a process in the > background: > > command & > > However, when I log out of the machine, the ssh process on my local > machine blocks. I guess that it is becuase the remote still has jobs > running. Is there a way to get it start the process in the background > and then detach from the shell? I have already tried this:

Continue reading

Try all colors in xterm with script before setting the color

2011-03-18 2 min read Bash Fedora Learning Linux

If you are looking for testing the colors on how they would look like in the xterm before you set the color then here is a small script for you.

  <td>
    <div class="text codecolorer">
      #!/bin/bash -<br /> #===============================================================================<br /> #<br /> #          FILE:  xterm_colors-test.sh<br /> #<br /> #         USAGE:  ./xterm_colors-test.sh<br /> #<br /> #   DESCRIPTION:  Test all the colors for xterm bg<br /> #<br /> #       OPTIONS:  ---<br /> #  REQUIREMENTS:  ---<br /> #          BUGS:  ---<br /> #         NOTES:  ---<br /> #        AUTHOR:   Amit Agarwal (amit.agarwal@amit-agarwal.co.in), aka<br /> #       COMPANY:  Individual<br /> #       VERSION:  1.0<br /> #       CREATED:  02/18/2011 01:02:51 PM IST<br /> #      REVISION:  1.0<br /> #===============================================================================<br /> <br /> cat /usr/share/X11/rgb.txt |sed 's/\([0-9]\{1,3\}[ \t]*\)\{3\}//'|sed 's/^ *//' >~/rgb.txt<br /> while read line<br /> do<br /> bg=$(echo $line)<br /> echo $line<br /> echo "Trying $bg color"<br /> xterm -bg "$bg"&<br /> sleep 5<br /> kill -9 $!<br /> done < ~/rgb.txt
    </div>
  </td>
</tr>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

This can be used in various ways but I will leave the choice to you. One option that I should probably still tell is :

Continue reading

cd across parallel directories

2011-03-14 1 min read Bash Linux

A diagram showing the key Unix and Unix-like o...
Image via Wikipedia

Here is a simple and fast way to cd across parallel directory.

  <td>
    <div class="text codecolorer">
      cd ${PWD/test/actual}
    </div>
  </td>
</tr>
1
Enhanced by Zemanta
Older posts Newer posts