Thursday, October 19, 2006

How to list only directories in Unix

Well this may seem a very simple problem, but its not. So it deserves a thread for sure

Traditional method

ls -l|grep ^d

But u get the other unwanted details, incase u are automating

Slightly Sophisticated

find . -type d

But on execution u will dicern that find is recursive, so "just the" folders of the current directory are not displayed

If its getting slightly complicated try this simpler solution.

ls -l|grep ^d|awk '{print $9}'

Pretty neat.
This command works almost fine. But just in case the folder has a "space", the command fails to get the exact name of the folder.

Here is a solution which "WORKS" and is very simple

ls -p |grep /

Just an indicator of the power of the raw tools invented ages ago. KISS(Keep it Simple S......)

Saturday, October 07, 2006

Google does it again

Check this out. Its out and open for people to use.

Now here are the interesting issues with it.
1) Be prepared for spams. Just try this, you will know.
2) Emotions the poor developers go through :-X . Just pick your slang, google does the rest.I just hope openSolaris is clean!!!!!!!!!!!!!!
3) Some programmers put the default password in sourcecode and Most lazy users never change the default password.This makes it easy to get the default password which can be exploited. Try this

Actually this is not a great innovation in itself. Krugle, Koders, and Codease are into this. But a gaint entering will have its own advatages.

"Good programmers write good code. Great programmers find it on Google!"