search function from cmdline