Spis treści

Linux: Network Commands in Linux

Below you will find an overview of the most important network commands with descriptions of their use and useful parameters.

ping

Checking host availability - Sends ICMP Echo Request packets to the target host and waits for a response. It is used to test the network connection and measure response time.

Useful parameters:

Example: ping -c 4 -i 0.5 8.8.8.8

ifconfig

Display of network interfaces configuration - shows details of all active network interfaces (IP, mask, MAC, statistics). On newer systems replaced by ip.

Useful parameters:

Example: ifconfig eth0 192.168.1.100 netmask 255.255.255.0

ip a (ip addr)

Modern IP configuration display - replacement ifconfig offering more detailed information about IP addresses, routers and interfaces. Part of the iproute2 package.

Useful parameters:

Example: ip addr add 192.168.1.50/24 dev eth0

route

Viewing and managing the routing table - shows how packets are routed to different networks. Allows you to add, delete and modify routes.

Useful parameters:

Example: route add default gw 192.168.1.1

ip route

Modern routing management - A newer replacement for the route with more intuitive syntax, part of the iproute2 package.

Useful parameters:

Example: ip route add 192.168.2.0/24 via 192.168.1.254

arp

Viewing and managing the ARP table - maps IP addresses to MAC (physical) addresses on the local network. Arp Resolution Protocol is used to recognise hardware addresses.

Useful parameters:

Example: arp -a -n

ip neigh

Modern neighbour table management (ARP) - a newer replacement for the arp with richer capabilities, part of the iproute2 package.

Useful parameters:

Example: ip neigh show dev eth0

traceroute

Tracking the path of packets to the destination - shows each router (hop) on the path from your computer to the destination host, along with the response time. Very useful for diagnosing network problems.

Useful parameters:

Example: traceroute -m 15 -n 8.8.8.8

mtr

Interactive route tracking with continuous monitoring - combination ping i traceroute displaying real-time statistics. Tool for advanced network diagnostics.

Useful parameters:

Example: mtr -c 50 -n 8.8.8.8

netstat

Display of network statistics and active connections - Shows open ports, active connections, protocol statistics and routing. Can monitor network activity in real time.

Useful parameters:

Example: netstat -tuln

ss

Modern replacement for netstat - Faster display of network socket information. Part of the iproute2 package, preferred in newer distributions.

Useful parameters:

Example: ss -tuln

dig

DNS queries for domain records - A tool for advanced DNS queries to check A, AAAA, MX, NS and other records.

Useful parameters:

Example: dig example.com +short

nslookup

A simpler version of the DNS query - Domain name recognition and reverse recognition tool (IP per domain). More accessible than dig.

Useful parameters:

Example: nslookup google.com 8.8.8.8

host

Recognition of names and IP addresses - A simple tool to check IP/domain mappings. More minimalistic than dig or nslookup.

Useful parameters:

Example: host google.com

curl / wget

HTTP/HTTPS download of web content and files - curl displays the response, wget downloads files to disk. Tools for testing HTTP connections and downloads.

Useful parameters (curl):

Example: curl -I https://example.com

tcpdump

Network packet capture and analysis - Tool for detailed analysis of network traffic at packet level. Requires administrator rights.

Useful parameters:

Example: tcpdump -i eth0 -n host 8.8.8.8

Quick reference table

Command Application Modern replacement
ping Host availability test -
ifconfig Interface configuration ip a / ip link
route Routing management ip route
arp ARP/MAC table ip neigh
netstat Network statistics ss
traceroute Packet traceroute mtr
dig/nslookup DNS queries -

This tutorial should give you a solid foundation for working with networking in Linux. Remember that most of these commands require Internet or local network access, and some (like tcpdump or configuration modification) require the privileges of sudo.