you can keep both the homes in env variables. While connecting from command prompt, make sure you set the proper home before connecting to either database or listener.

Regards,