Page cover

Basic commands

ping

Send ICMP ECHO_REQUEST packets to network hosts. This command helps to verify that an DNS entry is reachable and can be resolved. You can also ping an IP address directly to exclude DNS issues. The response times can be an indicator of bad network connections.

ping google.com

PING google.com (142.250.186.78): 56 data bytes
64 bytes from 142.250.186.78: icmp_seq=0 ttl=59 time=14.813 ms
64 bytes from 142.250.186.78: icmp_seq=1 ttl=59 time=20.750 ms
64 bytes from 142.250.186.78: icmp_seq=2 ttl=59 time=19.693 ms
64 bytes from 142.250.186.78: icmp_seq=3 ttl=59 time=16.061 ms
...

wget

The non-interactive network downloader. This is an easy way to download files from websites.

wget heise.de

--2021-10-15 19:57:35--  http://heise.de/
Resolving heise.de (heise.de)... 193.99.144.80
Connecting to heise.de (heise.de)|193.99.144.80|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.heise.de/ [following]
--2021-10-15 19:57:35--  https://www.heise.de/
Resolving www.heise.de (www.heise.de)... 193.99.144.85
Connecting to www.heise.de (www.heise.de)|193.99.144.85|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 687281 (671K) [text/html]
Saving to: ‘index.html’

index.html
...

arp

Address resolution display and control. ARP stands for Address Resolution Protocol. It is used to resolve the IP address of a system to its MAC address, and hence it works between level 2 (Data link layer) and level 3 (Network layer). For larger production environment you sometimes run into strange network problems. If you have more than 1024 IP assigned to processes / hosts then you need to increase the ARP cache settings via sysctl.

curl

Transfer data from or to a server. Supported protocols: HTTP, HTTPS, FTP, FTPS, IMAP, LDAP, TELNET, ...)

  1. HTTP GET data websites

  2. Send HTTP GET/PUT/DELETE/POST data to REST APIs

dig

  1. Perform DNS lookups

  2. Find host addresses, IP addresses, CNAMEs, name servers, and more

  3. Verify Internet connectivity

ip

Internet Protocol. IP is the transport layer protocol used by the Internet protocol family.

nmap

Nmap ("Network Mapper") is a free and open source (licensearrow-up-right) utility for network discovery and security auditing.

traceroute

Print the route packets take to network host. This command is useful when you want to know all the hops that a packet takes to a destination.

ifconfig

Configure network interface parameters.

tcpdump

Capture your local TCP traffic in different formats for further analysis.

A great tool for analysing TPC traffic is https://www.wireshark.org/arrow-up-right

Port Forwarding

Use port forwarding to bind port from other host to localhost. This can be useful when a server does not allow connecting to a port from the outside. Then you can simply forward the port and access it locally.

netstat

Show which interface/port a process (PID) is using

iptraf

Interactive Colorful IP LAN Monitor. Useful tool to see traffic flowing between servers. Useful when identifying cross availability zone traffic that can be quite expensive with cloud providers like AWS and GCP.

systemd-resolve

Resolve domain names, IPV4 and IPv6 addresses, DNS resource records, and services.

ssh

OpenSSH SSH client (remote login program). Standard tool to access remote server via port 22 securely.

scp

Secure copy (remote file copy program).

rsync

Sync remote files / directories with your local files / directories. The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection, using an efficient checksum-search algorithm described in the technical report that accompanies this package.

sysctl

The sysctl utility retrieves kernel state and allows processes with appropriate privilege to set kernel state.

telnet

The telnet command is used to communicate with another host using the TELNET protocol. First tool of choice to check if ports are reachable during debugging sessions.

whois

Internet domain name and network number directory service.

Last updated