Below commands can be used to fetch the opened ports in a remote server:
telnet , nmap
The telnet command is used to communicate with another host using the TELNET protocol.
Nmap (Network Mapper) is a security scanner used to discover hosts and services on a computer network, thus creating a “map” of the network. To accomplish its goal, Nmap sends specially crafted packets to the target host and then analyzes the responses.