[ TechDocsCove ]  TechDocsCove en   ↩︎

# Essential Linux Network Commands for Webmasters

computer networks   linux   shell   webmaster tools  

translations: [ es/Español ] · [ fr/Français ] · [ de/Deutsch ]


Table of contents


Webmasters rely on various Linux commands to diagnose and manage network-related aspects. These commands aid in understanding connectivity, DNS, fetching data, and network analysis. Below is an extensive list of essential network commands with explanations, examples, and outputs:

ping - Check remote resource

A fundamental command that tests the connectivity to a remote resource by sending packets and measuring the round-trip time.

ping example.com

Example Output:

64 bytes from 93.184.216.34: icmp_seq=1 ttl=54 time=20.1 ms
64 bytes from 93.184.216.34: icmp_seq=2 ttl=54 time=19.8 ms
64 bytes from 93.184.216.34: icmp_seq=3 ttl=54 time=18.9 ms

This output showcases successful round-trip communications with the remote server (example.com), providing information about the time taken for the packets to reach the server and return to the local machine.

traceroute - Trace the route to a remote resource

Traces the path packets take to reach a destination, displaying each hop and latency between routers.

traceroute example.com

Example Output:

 1  gateway (192.168.1.1)  2.500 ms  2.501 ms  2.503 ms
 2  207.241.251.1 (207.241.251.1)  10.317 ms  10.319 ms  10.320 ms
 3  75.75.75.75 (75.75.75.75)  10.321 ms  10.322 ms  10.323 ms
 4  11.22.33.44 (11.22.33.44)  20.624 ms  20.625 ms  20.626 ms
 ...

This output displays the route taken by packets towards the remote server (example.com) and shows each hop along with its latency.

dig - Query DNS information about a domain

Provides detailed DNS-related information about a domain, assisting in understanding its DNS records.

dig example.com

Example Output:

; <<>> DiG 9.10.6 <<>> example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12345
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;example.com.           IN  A

;; ANSWER SECTION:
example.com.        3600    IN  A   93.184.216.34

;; Query time: 50 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Mon Jan 07 12:34:56 PST 2024
;; MSG SIZE  rcvd: 56

This output provides detailed DNS information about the domain (example.com), including its IP address and query timings.

host - Perform DNS lookup for a domain

Resolves a domain name to its associated IP address, aiding in domain-to-IP resolution.

host example.com

Example Output:

example.com has address 93.184.216.34
example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946

This output reveals the IP addresses associated with the domain (example.com), including both IPv4 and IPv6 addresses.

whois - Fetch domain registration details

Retrieves domain registration information and ownership details about a given domain.

whois example.com

Example Output:

Domain Name: example.com
Registry Domain ID: 12345678_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.iana.org
Registrar URL: http://iana.org
Updated Date: 2024-01-01T00:00:00Z
Creation Date: 1995-01-01T00:00:00Z
...

This output presents domain registration information, including registrar details, creation date, and domain status.

nmap - Scan ports and discover hosts

Scans ports and discovers hosts on a network, providing an overview of open ports and services.

nmap example.com

Example Output:

Starting Nmap 7.91 ( https://nmap.org ) at 2024-01-07 12:34 PST
Nmap scan report for example.com (93.184.216.34)
Host is up (0.045s latency).
Not shown: 998 filtered ports
PORT     STATE  SERVICE
80/tcp   open   http
443/tcp  open   https

Nmap done: 1 IP address (1 host up) scanned in 1.23 seconds

This output displays open ports and available services on the server (example.com), aiding in network security assessments.

curl - Retrieve information from a URL

Fetches data from URLs, enabling the retrieval of HTTP headers, SSL certificate details, and content.

curl -I https://example.com

Example Output:

HTTP/2 200
server: nginx
date: Mon, 07 Jan 2024 20:10:00 GMT
content-type: text/html; charset=UTF-8
content-length: 12345
...

This output shows HTTP headers when accessing the URL (https://example.com), providing metadata about the server’s response.

wget - Download files from the internet

Allows the download of files from the internet by providing the URL of the desired file.

wget https://example.com/file.zip

Example Output:

--2024-01-07 12:34:56--  https://example.com/file.zip
Resolving example.com (example.com)... 93.184.216.34, 2606:2800:220:1:248:1893:25c8:1946
Connecting to example.com (example.com)|93.184.216.34|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12345678 (12M) [application/zip]
Saving to: ‘file.zip’

file.zip                100%[==================================>]  12.35M  10.0MB/s    in 1.2s

2024-01-07 12:34:58 (10.0 MB/s) - ‘file.zip’ saved [12345678/12345678]

This output demonstrates the process of downloading a file (file.zip) from the URL (https://example.com) using wget.



Created on: Jan 7, 2024


Email shareIcon for sharing via email    Reddit shareIcon for sharing via Reddit    X shareIcon for sharing via X    Telegram shareIcon for sharing via Telegram    WhatsApp shareIcon for sharing via WhatsApp    Facebook shareIcon for sharing via Facebook    LinkedIn shareIcon for sharing via LinkedIn



Discover More within this Subject: