Here are some common networking commands used in the terminal to manage and troubleshoot network connections:
Basic Networking Commands:
-
ping:- Tests connectivity to a host by sending ICMP echo requests.
ping example.com # Ping a website -
ifconfig(orip a):- Displays network interface configuration (use
ip afor modern systems).
ifconfig # Show network interfaces and their configurations ip a # Show network interfaces using the ip command - Displays network interface configuration (use
-
netstat:- Displays network connections, routing tables, and interface statistics.
netstat -tuln # Show listening ports and their status -
traceroute(ortracerton Windows):- Traces the route packets take to a network host.
traceroute example.com # Trace the route to a website -
nslookup:- Queries the DNS to obtain domain name or IP address mapping.
nslookup example.com # Get the IP address of a domain
Advanced Networking Commands:
-
curl:- Transfers data from or to a server using various protocols (HTTP, FTP, etc.).
curl http://example.com # Fetch the content of a webpage -
wget:- Downloads files from the web.
wget http://example.com/file.zip # Download a file -
ssh:- Securely connects to a remote server via SSH.
ssh user@example.com # Connect to a remote server -
scp:- Securely copies files between hosts on a network.
scp localfile.txt user@example.com:/path/to/destination/ # Copy a file to a remote server -
iptables:- Configures the Linux kernel firewall.
sudo iptables -L # List current firewall rules
Network Troubleshooting Commands:
-
dig:- Performs DNS lookups and displays detailed information.
dig example.com # Get DNS information for a domain -
route:- Displays or modifies the IP routing table.
route -n # Show the routing table -
hostname:- Displays or sets the system's hostname.
hostname # Show the current hostname
Additional Useful Commands:
whois: Retrieves domain registration information.iperf: Measures network bandwidth between two hosts.
These commands are fundamental for managing and troubleshooting network connections in Linux and other Unix-like operating systems. If you have any specific commands you'd like to learn more about, feel free to ask!
