Here are the top 10 networking commands in Linux, along with sample examples:
- ifconfig
Used to configure or display the network interfaces.
Example:
ifconfig
This will display details like IP address, netmask, and broadcast for each network interface.
- ip
The newer alternative to ifconfig used to display or manipulate routing, devices, policy routing, and tunnels.
Example:
ip addr show
This command shows the IP addresses of all the network interfaces.
- ping
Used to check the connectivity between the host and the destination.
Example:
ping google.com
This will continuously ping Google's server to check if it's reachable.
- netstat
Displays network connections, routing tables, interface statistics, and more.
Example:
netstat -tuln
This command shows all the listening (open) ports on the system, along with their corresponding services.
- traceroute
Shows the path that a packet takes to reach the destination.
Example:
traceroute google.com
This will display each hop on the way to Google's server and the response times for each.
- nslookup
Queries DNS to retrieve domain name or IP address mapping.
Example:
nslookup google.com
This will display the IP address associated with google.com.
- dig
Another tool for querying DNS records, providing more detailed output compared to nslookup.
Example:
dig google.com
This will give detailed DNS information about the domain google.com.
- route
Used to show or manipulate the IP routing table.
Example:
route -n
This displays the kernel's IP routing table, showing the available routes.
- iptables
Used to configure the Linux kernel firewall for packet filtering.
Example:
sudo iptables -L
This will list all the current firewall rules in place.
- curl
A tool to transfer data to or from a server using protocols such as HTTP, FTP, etc.
Example:
curl http://example.com
This command fetches the HTML content of example.com.
These commands are essential for diagnosing and managing network configurations on a Linux system.
Top comments (0)