Education !!!

Education is derived from educare (Latin) - meaning - to educe, to draw out, to DEVELOP FROM WITHIN, wonder how many knew this !!!

Facts - Open Source

Design of Sun's UltraSPARC T1 processor is made available under GNU public License (GPL). This is first open source 64-bit processor.

Technical Acronyms

Please send in your list to be added here ....

(In ascending order)

GNU - Gnu's Not Unix
GPL - GNU General Public License
SIP - Session Initiation Protocol
SPARC - Scalable Processor Architecture

*NIX utilities

1) You are in a directory lets say "/home/xyz" and you want to find some file lets say "abc.txt" and open it using vi. We normally do

# find /home/xyz -name abc.txt
# vi /abc.txt

Simply you can do :
# find /home/xyz -name abc.txt -exec vi {} +

You can make an alias of above command and it in your profile file.

But if you have more then one abc.txt file and you want to open only one of them, you can use the following script.

# vi fvi

################################################################
#small script that finds the file given at command line and vi it
#needs improvement
if [ $# -ne 1 ]
then
echo "Usage: $0 "
exit 1
fi
result=`find . -name $1`
file=`echo $result | awk '{print $1}'`
if [ -n "$file" ]
then
vi $file
else
echo "$file not found"
fi
################################################################

How to use it
1) Copy the script to some folder where everybody can access it, like "/usr/bin/"
2) chmod 755 /usr/bin/fvi

Let say you want to find and vi abc.txt from /home/xyz
# cd /home/xyz
# fvi abc.txt

date command in *NIX

How to get yesterday / past / future dates in *NIX

Ref

http://www.cyberciti.biz/tips/linux-unix-get-yesterdays-tomorrows-date.html

Get yesterday date

1)

YESTERDAY=`TZ=aaa24 date +%Y%m%d`

echo $YESTERDAY


2)

in GNU date:

date --date=yesterday

Shell Scripting

1) for loop
1.1) Simple for loop
# for i in `seq 1 3`
> do
> echo "i is $i"
> done
i is 1
i is 2
i is 3


# for i in 192.168.0.{1..5}
> do
> echo "i is $i"
> done
i is 192.168.0.1
i is 192.168.0.2
i is 192.168.0.3
i is 192.168.0.4
i is 192.168.0.5

# ls
dir1 dir2 file1 file2
# for i in `ls`
> do
> echo "i is $i"
> done
i is dir1
i is dir2
i is file1
i is file2

2) set command
# date
Sun Apr 12 22:41:37 IST 2009

# set `date`
# echo $#
6
# echo $1
Sun
# echo $2
Apr
# echo $3
12
# echo $4
22:41:37
# echo $5
IST
# echo $6
2009

Books I like

  • Inside C++ Object Model
  • Unix Network Programming - Stevens
  • Professional-c++-programmer-to-programmer - wrox
  • Beautiful-code-leading-programmers-explain-how-they-think-theory-in-practice