The Linux command shell is your fastest way to see what networks your system is connected to, whether it’s Wi-Fi, Ethernet, or even VPN links. Run these simple commands to list active connections, check signal strengths, and troubleshoot connectivity issues without opening GUI apps. This works on most modern Linux distributions (Ubuntu, Fedora, Arch, etc.) and macOS Terminal, though exact syntax varies slightly by OS.
What You'll Need
- Access to a terminal (Command Prompt on Windows, Terminal on macOS/Linux).
- Basic knowledge of command-line shortcuts like
tabfor autocompletion. - Administrator privileges may be required for advanced checks (e.g.,
ifconfigoripon older systems). - A modern Linux distribution or macOS system with networking tools installed (usually pre-installed).
- For Windows users: Windows Terminal or PowerShell (see Frequently Asked Questions for alternatives).
Step-by-Step
- List active network interfaces
Run this command to see all network adapters your system recognizes, including Wi-Fi, Ethernet, and virtual interfaces like VPNs.
- Linux (modern distros: Ubuntu 22.04+, Fedora, Arch):
ip linkorifconfig -a(older systems). HoldCtrl+Alt+Tto open the terminal. - macOS:
networksetup -alllists all adapters, or useifconfigfor detailed stats. - Windows (Command Prompt/PowerShell):
ipconfig /all(shows only physical adapters) ornetsh interface ipv4 show interfaces(more detailed).
Example output:
1: lo:mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 3: wlan0: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 54:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff Note: Wi-Fi interfaces often start with
wlan(Linux/macOS) orWi-Fi(Windows). Ethernet is typicallyeth0orenp3s0. - Linux (modern distros: Ubuntu 22.04+, Fedora, Arch):
- Check Wi-Fi networks (signal strength + neighbors)
To see nearby Wi-Fi networks and your current connection details, use:
- Linux/macOS:
iw list(lists available networks) oriw dev wlan0 scan(scans for neighbors). For your active connection, run:iw dev wlan0 link(Linux) ornetworksetup -showall Wi-Fi(macOS). - Windows:
Use PowerShell:
Get-NetIPAddress -InterfaceAlias "Wi-Fi" | Select-Object InterfaceAlias, IPAddress, InterfaceDescriptionTo scan for nearby SSIDs (requires admin):netsh wlan show networksthennetsh wlan connect name="SSID".
Example (Linux):
[sudo] password for youruser: wlan0: interface Iface, chipset Qualcomm Atheros QCA9377 supported channels: 1-14 52-140 MHz supported rates: 1-100 Mbps SSID: "MyHomeWiFi" (BSSID: 00:11:22:33:44:55) signal: -30 dBm - Linux/macOS:
- View active connections (TCP/UDP ports)
To see what apps are using ports (useful for troubleshooting), run:
- Linux/macOS:
lsof -i(lists open network sockets) orss -tulnp(shows TCP/UDP ports + PID). - Windows:
Use Process Explorer (from Microsoft Sysinternals) or:
netstat -ano(shows active connections by process ID). Filter for specific ports withnetstat -ano | findstr "PORT".
Example (Linux):
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sshd 1234 root 12u IPv4 12345 0t0 TCP *:ssh (LISTEN) nginx 5678 www-data 33u IPv4 45678 0t0 TCP localhost:80 (LISTEN) - Linux/macOS:
- Test connectivity to networks
Verify if a network (e.g., a remote server or local IP) is reachable:
- Ping test:
ping google.com(Linux/macOS/Windows) orping -c 3 google.com(3 pings). - Advanced: traceroute
Linux/macOS:
traceroute google.comWindows:tracert google.com(Shows hops from your router to the target.)
- Ping test:
Common Mistakes
- Using the wrong interface: If you run
ifconfigbut onlylo(loopback) appears, your system isn’t connected to a physical network. Check withip aorifconfig -ato confirm Wi-Fi/Ethernet is active. - Admin privileges denied: Tools like
iwornetshmay require sudo. Addsudobefore the command (Linux/macOS) or try the command in an elevated PowerShell terminal (Windows). - Ignoring timezone/locale issues: On Linux, commands like
iwmay show incorrect signal strength if the system’s locale isn’t set to UTF-8. Fix with:export LANG=en_US.UTF-8before running the command. - Mixing Linux/macOS commands on Windows: Windows’
ipconfigbehaves differently from Linux’siporifconfig. Stick to Windows-native commands unless you’re using WSL (Windows Subsystem for Linux).
Tips
- Save output to a file: Redirect commands to a file for later analysis. Example:
iw dev wlan0 link > network_status.txt(Linux). - Monitor changes over time: Use
watch -n 1(Linux) orping google.comrepeatedly to see if network metrics fluctuate. - Wi-Fi signal strength: On Linux,
iw dev wlan0 linkshows signal strength in dBm (lower = weaker). On macOS, usenetworksetup -getinfo Wi-Fifor details. - Windows alternative: PowerShell: For more advanced networking, explore WMI (Windows Management Instrumentation) with
Get-WmiObject Win32_NetworkAdapterConfiguration. - GUI fallback: If commands fail, use the system’s built-in network settings (e.g., Ubuntu’s
NetworkManager GUIor macOS System Preferences).
Troubleshooting
If commands return no results or show errors, start with these checks:
- Restart networking
On Linux/macOS:
sudo systemctl restart NetworkManager(Ubuntu) orsudo systemctl restart NetworkManager.service(Fedora). On Windows:netsh interface resetin an admin Command Prompt. - Update tools
Ensure your system and tools are up to date. For Linux, run:
sudo apt update && sudo apt upgrade(Debian/Ubuntu) or:sudo pacman -Syu(Arch). Check for macOS updates in System Settings. - Check service status
If
iwornetshfails, verify the network services are running:sudo systemctl status NetworkManager(Linux). On Windows, checkservices.mscfor "Network Connections." - Reinstall tools
If commands persistently fail, reinstall the tool:
sudo apt reinstall ifconfig iputils-ping(Linux) or reinstall macOS utilities viaSoftware Update. - Verify Wi-Fi is enabled
On macOS, right-click the Wi-Fi icon in the menu bar and ensure "Wi-Fi" is turned on. On Linux, check
iw dev—if no Wi-Fi interfaces appear, toggle Wi-Fi in your distro’s GUI settings. - Alternative: Use GUI tools
If CLI tools are unreliable, use the system’s native network manager (e.g., Ubuntu’s
nmcli, macOS System Preferences, or Windows Network Settings). Avoid third-party tools unless they integrate with official APIs.
Frequently Asked Questions
How do I see my current IP address?
Run ip a (Linux/macOS) or ipconfig (Windows) and look for the inet lines under your active interface (e.g., wlan0 or Wi-Fi).
What if I don’t see my Wi-Fi adapter in the commands?
This usually means your Wi-Fi is disabled or unrecognized. Check with lsusb (Linux) to confirm a Wi-Fi chip is plugged in, or enable Wi-Fi in your distro’s GUI settings.
Can I check network traffic in real-time?
Yes! Use iftop (Linux) or Windows Performance Toolkit (Windows) to monitor bandwidth usage per connection. Install iftop with sudo apt install iftop (Debian).
Why does ping say "Request timed out" when the network is connected?
This often means your device is blocking ICMP (ping) requests. Try traceroute or check if ICMP is disabled in your firewall (Linux: sudo ufw allow in 8 for ICMP).
How do I find my router’s IP address?
On Linux/macOS: Run arp -a and look for your local IP. On Windows: Use arp -a or ipconfig /all. Your router’s IP is usually 192.168.1.1 or 10.0.0.1.
Is there a way to see which apps are using the internet?
Use lsof -i (Linux) or netstat -ano (Windows) to list active connections. For macOS, use netstat -vn.