Do note, Undernet does not have NickServ so your command will not work.
You can try /msg X info username instead though - note that their nickname is not necessarily the same as their USERNAME. You cannot register nicknames on Undernet, only usernames. If you don't know his username then you can't use the command. If he hasn't got a username, or has set himself 'Invisible' with X, then you also won't be able to obtain that information from X.
As landon said, commands should generally be executed in the Status window, especially commands that involve passwords. However, for general commands such as the one above, typing them anywhere should be fine - just make sure they start with a /.
Regards,