Find a name of the package in ubuntu

I have been trying to find a package name in ubuntu.Thats makes it keep on hitting my mind.Atlast i have landed up with a solution by googling.

Here is the command that you can try with name of the package you know and it will tell you the exact package name.

sudo apt-cache search package-name;

For example, i want to install java sdk in Ubuntu, but i do not know the exatly package name to install, i can issue following command to search “java sdk”.

sudo apt-cache search java sdk

After executing the above command you will get the exact name of the package like

sudo apt-get install sun-java6-sdk