How to search for debian packages with command line?

The apt-cache search command will return all packages that have name in the package name or description:

apt-cache search name

Once you have a package name, you can get more detailed information on the package using the apt-cache show and apt-cache showpkg commands.

apt-cache show package_name
apt-cache showpkg package_name

apt-cache search