Skip to content

Linux Commands: Networking

Interfaces, connections, transfers and diagnostics, plus mail and user messaging.

Part of the Linux commands cheat sheet.

Networking Commands

arp — Manipulate the system ARP cache:

arp -a

curl — Transfer a URL:

curl -O http://example.com/file.zip

host — DNS lookup utility:

host example.com

hostid — Print the numeric identifier for the current host:

hostid

hostname — Show or set the system's host name:

hostname

hostnamectl — Control the system hostname:

hostnamectl set-hostname server1

ifconfig — Configure a network interface (legacy; use ip):

ip addr show eth0      # modern replacement
ifconfig eth0          # legacy net-tools, often not installed

iftop — Display bandwidth usage on an interface:

iftop -i eth0

ifup — Bring a network interface up:

ifup eth0

ip — Show / manipulate routing, network devices, interfaces and tunnels:

ip addr show

ipcrm — Remove a message queue, semaphore set, or shared memory id:

ipcrm -m 1234

ipcs — Provide information on ipc facilities:

ipcs -m

iptables — Administration tool for IPv4 packet filtering and NAT:

iptables -L

iptables-save — Dump iptables rules to stdout:

iptables-save > /etc/iptables/rules.v4

iwconfig — Configure a wireless network interface:

iwconfig wlan0

`nc(netcat)` — Arbitrary TCP and UDP connections and listens:

nc -lvp 8080

netstat — Print network connections, routing tables, interface statistics, etc (legacy; use ss):

ss -tuln               # modern replacement
netstat -tuln          # legacy net-tools, often not installed

nmcli — Command-line tool for controlling NetworkManager:

nmcli connection show

nslookup — Query Internet name servers interactively:

nslookup example.com

ping — Send ICMP ECHO_REQUEST to network hosts:

ping 8.8.8.8

rcp — Remote file copy:

rcp file.txt host:/tmp/

route — Show / manipulate the IP routing table:

route -n

rsync — Fast, versatile, remote (and local) file-copying tool:

rsync -avz /local/dir/ user@remote:/remote/dir/

scp — Secure copy:

scp file.txt user@remote:/tmp/

ssh — OpenSSH SSH client:

ssh user@remote

tracepath — Traces path to a network host discovering MTU:

tracepath 8.8.8.8

traceroute — Print the route packets trace to network host:

traceroute example.com

vnstat — Console-based network traffic monitor:

vnstat -i eth0

wget — The non-interactive network downloader:

wget http://example.com/file.iso

Mail and User Communication Commands

biff — Be notified if mail arrives and who it is from:

biff y

mailq — Print the mail queue:

mailq

write — Send a message to another user:

write username

wall — Send a message to everybody's terminal:

wall "System will go down in 10 minutes"