This is from my question and answer in askubuntu.
You can use the command
sudo nmap -sP -PE -PA21,23,80,3389 192.168.1.*
nmap: Network exploration tool and security / port scanner
-sP (Skip port scan) .
This option tells Nmap not to do a port scan after host discovery, and only print out the available
hosts that responded to the scan. This is often known as a “ping scan”, but you can also request that
traceroute and NSE host scripts be run. This is by default one step more intrusive than the list
scan, and can often be used for the same purposes. It allows light reconnaissance of a target network
without attracting much attention. Knowing how many hosts are up is more valuable to attackers than
the list provided by list scan of every single IP and host name.
-PE; -PP; -PM (ICMP Ping Types) .
In addition to the unusual TCP, UDP and SCTP host discovery types discussed previously, Nmap can send
the standard packets sent by the ubiquitous ping program. Nmap sends an ICMP type 8 (echo request)
packet to the target IP addresses, expecting a type 0 (echo reply) in return from available hosts..
Unfortunately for network explorers, many hosts and firewalls now block these packets, rather than
responding as required by RFC 1122. For this reason, ICMP-only scans are rarely reliable enough
against unknown targets over the Internet. But for system administrators monitoring an internal
network, they can be a practical and efficient approach. Use the -PE option to enable this echo
-A (Aggressive scan options) .
This option enables additional advanced and aggressive options.
21,23,80,3389 Ports to search through
192.168.1.* Range of IPs. replace with yours.