colors in bash -- script to display all the possible colors.

2010-06-06 3 min read Bash Fedora Linux

If you wanted to have colors in the bash output (including the colors in PS1-4), don’t you keep wondering how the color code would look on the terminal. So, I wrote this small script to show the complete color codes. This is how the output would look:

\"Bash

And here is the script:

  <td>
    <div class="text codecolorer">
      #!/bin/bash -<br /> #===============================================================================<br /> #<br /> # &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FILE: &nbsp;colors.sh<br /> #<br /> # &nbsp; &nbsp; &nbsp; &nbsp; USAGE: &nbsp;./colors.sh<br /> #<br /> # &nbsp; DESCRIPTION: &nbsp;Bash colors<br /> #<br /> # &nbsp; &nbsp; &nbsp; OPTIONS: &nbsp;---<br /> # &nbsp;REQUIREMENTS: &nbsp;---<br /> # &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BUGS: &nbsp;---<br /> # &nbsp; &nbsp; &nbsp; &nbsp; NOTES: &nbsp;---<br /> # &nbsp; &nbsp; &nbsp; &nbsp;AUTHOR: &nbsp;Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in<br /> # &nbsp; &nbsp; &nbsp; COMPANY: &nbsp;Individual<br /> # &nbsp; &nbsp; &nbsp; VERSION: &nbsp;1.0<br /> # &nbsp; &nbsp; &nbsp; CREATED: &nbsp;09/21/2009 06:12:07 PM IST<br /> # &nbsp; &nbsp; &nbsp;REVISION: &nbsp;---<br /> #===============================================================================<br /> <br /> for c in `seq 0 255`;<br /> do<br /> t=5;<br /> [[ $c -lt 108 ]]&&t=0;<br /> for i in `seq $t 5`;<br /> do<br /> #Display the codes also for easier lookup in terminal<br /> <!--loginview start-->echo $i;${c}<!--loginview end--><br /> echo -e "<a class="zem_slink" title="Path (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Path_%28computing%29">\\</a>\e[0;48;$i;${c}m|| $i:$c `seq -s+0 $(($COLUMNS/2))|tr -d \'[0-9]\'`\\e[0m";<br /> done;<br /> done<br /> <br /> # setup_colors - Adds colors to array CC for global use<br /> # 30 - Black, 31 - Red, 32 - Green, 33 - Yellow, 34 - Blue,<br /> # 35 - Magenta, 36 - Blue/Green, 37 - White,<br /> # 30/42 - Black on Green \'30\\;42\'<br /> <!--loginview start-->function setup_colors(){<br /> declare -a CC;<br /> for i in `seq 0 7`;<br /> do<br /> ii=$(($i+7));<br /> CC[$i]="\\033[1;3${i}m";<br /> CC[$ii]="\\033[0;3${i}m";<br /> done;<br /> CC[15]="\\033[30;42m";<br /> R=$\'\\033[0;00m\';<br /> X=$\'\\033[1;37m\';<br /> export R X;<br /> }<br /> function display_colors(){<br /> for i in $(seq 0 $((${#CC[@]} - 1))); do echo -e "${CC[$i]}[$i]\\n$R"; done<br /> }
    </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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
\"Reblog
Enhanced by Zemanta

PuTTY ssh without password

2010-06-05 1 min read Linux

you can do a ssh without password.. Today we will see how to do this with putty.

Generate public/private (DSA)key pair using puttygen.
copy the public key to ~/.ssh/authourized_keys on your server (moonware/sunware/skyware). Same key can be used on all the servers.
make sure that your home directory permissions are 755
directory permission for .ssh is 700
file permission for authourized_keys is 600
now login using putty and specify your private key in the configuration of putty and also specify your username.

Continue reading

Security — Installing and monitoring snort logs.

2010-06-04 2 min read Fedora Linux

Snort is a very good security tool to install if you are concerned about the security of your system. I find it really useful but the problem is I keep forgetting to monitor the logs so what did I do, I installed snort and configured cron to send to logs everyday, here&#8217;s how.

On fedora, snort is available in the repository but the rules are not. So to install snort just type in the following in a terminal:

Continue reading

SQuirrel SQL for Graphical interface to Oracle/MySQL and loads of other database -- OSS and free.

2010-06-04 1 min read Linux

<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category

SQuirrel <a class="zem_slink freebase/en/sql" title="SQL" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL">SQL for <a class="zem_slink freebase/en/graphical_user_interface" title="Graphical user interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Graphical_user_interface">Graphical interface to Oracle/MySQL and loads of other <a class="zem_slink freebase/en/database" title="Database" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database">database — <a class="zem_slink freebase/en/open_sound_system" title="Open Sound System" rel="homepage" href="http://www.opensound.com/">OSS and free.

<a class="zem_slink freebase/en/squirrel_sql_client" title="SQuirreL SQL Client" rel="homepage" href="http://www.squirrelsql.org/">SQuirreL SQL Client is a graphical SQL client written in <a class="zem_slink freebase/guid/9202a8c04000641f800000000f8545aa" title="Java (programming language)" rel="homepage" href="http://java.sun.com">Java that will allow you to view the structure of a <a class="zem_slink freebase/en/java_database_connectivity" title="Java Database Connectivity" rel="wikipedia" href="http://en.wikipedia.org/wiki/Java_Database_Connectivity">JDBC compliant database, browse the <a class="zem_slink freebase/en/data" title="Data" rel="wikipedia" href="http://en.wikipedia.org/wiki/Data">data in tables, issue SQL commands etc. The pre-requisites are java 1.5 and 1.6 in the sequence of the <a class="zem_slink freebase/en/installation" title="Installation (computer programs)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Installation_%28computer_programs%29">installer versions! Installers available at: <a href="http://sourceforge.net/projects/squirrel-sql/files/">http://sourceforge.net/projects/squirrel-sql/files/ Home page and installation instructions at: <a href="http://www.squirrelsql.org/#installation">http://www.squirrelsql.org/#installation Have a nice time with the SQuirreL!!<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/04/27/fvwm-look-and-feel-icons-and-themes/">fvwm Look and Feel, icons and themes (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://checkedexception.blogspot.com/2010/03/using-ms-sql-from-linux.html">Using MS SQL from Linux (checkedexception.blogspot.com) <li class="zemanta-article-ul-li"><a href="http://briancarper.net/blog/adminer-where-have-you-been-all-my-life">Adminer, where have you been all my life? (briancarper.net) <li class="zemanta-article-ul-li"><a href="http://helpdeskgeek.com/databases/an-introduction-to-oracle-sql-developer-part-v/">An Introduction to Oracle SQL Developer – Part V (helpdeskgeek.com) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/6c1be63c-1479-4ac2-9707-3e8c8b750585/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b12.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Continue reading

Linux Community\’s unoffical mascot taken by Microsoft

2010-06-04 3 min read Linux

Ok, this is mostly a Linux advocacy and I kind of completely agree with <a href="http://linuxlock.blogspot.com/2008/11/congrats-linux-community-youve-been.html" target="_blank">this.

Here&#8217;s the main text, but dont forget to go to the page to read the comments( quite good and interesting thoughts by lot of people).

OK group…let&#8217;s see a show of hands…

How many people believe that the current way Linux markets itself is sufficient? That would be the combination of apathy, inertia and a smattering of guerrilla marketing.

Continue reading

More precise BASH debugging

2010-06-03 1 min read Linux

<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category
More precise BASH debugging

$ env PS4=&#8217; ${BASH_SOURCE}:${LINENO}(${FUNCNAME[0]}) &#8217; sh -x /etc/profile

* View this command to comment, vote or add to favourites * View all commands by unixmonkey4483

commandlinefu.com

by David Winterbottom (codeinthehole.com)

<a class="zem_slink freebase/en/uniform_resource_locator" title="Uniform Resource Locator" rel="wikipedia" href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator">URL: <a href="http://feedproxy.google.com/~r/Command-line-fu/~3/G6-BkEkeLaA/more-precise-bash-debugging">http://feedproxy.google.com/~r/Command-line-fu/~3/G6-BkEkeLaA/more-precise-bash-debugging<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://psychedelichippiemusic.blogspot.com/2010/05/18-reasons-why-exile-on-main-street.html">18 Reasons Why &#8217;Exile On Main Street&#8217; Deserves Its Rep (psychedelichippiemusic.blogspot.com) <li class="zemanta-article-ul-li"><a href="http://www.neatorama.com/2010/06/03/what-is-it-game-141/">What Is It? Game 141 (neatorama.com) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/04/30/delete-files-folder-match-file-extension/">Delete all files in a folder that don&#8217;t match a certain file extension (amit-agarwal.co.in) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/9e918d90-d5b4-438c-8992-4e8db58969df/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b7.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Continue reading
Older posts Newer posts