How to find all machines in local network

find Gateway by route command

route -n
---------------------------------
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    100    0        0 enp8s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 enp8s0
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp8s0

netdiscover

sudo netdiscover -r 192.168.0.1/24
----------------------------------------
 3 Captured ARP Req/Rep packets, from 3 hosts.   Total size: 162                                                                                         
 _____________________________________________________________________________
   IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
 -----------------------------------------------------------------------------
 192.168.0.1     a0:xxxxxxxxxxxxxx      1      60  TP-LINK                                                                      
 192.168.0.100   a1:xxxxxxxxxxxxxx      1      60  ASUSTek                                                                                 
 192.168.0.101   a2:xxxxxxxxxxxxxx      1      42  CADMUS COMPUTER SYSTEMS 

nmap scan base on the Gateway

nmap 192.168.0.1/24 -n -sP
--------------------------------
Starting Nmap 7.01
Nmap scan report for 192.168.0.1 - Host is up (0.00083s latency).
Nmap scan report for 192.168.0.100 - Host is up (0.00045s latency).
Nmap scan report for 192.168.0.101 - Host is up (0.00043s latency).
Nmap scan report for 192.168.0.102 - Host is up (0.096s latency).
Nmap scan report for 192.168.0.104 - Host is up (0.0014s latency).
Nmap done: 256 IP addresses (5 hosts up) scanned in 3.08 seconds