Linux Commands - Internet Specific Commands
Commonly used flags:
- -4: Use ipv4 only
- -6: Use ipv6 only
- -c: Stop after sending specified counts.
- -I: Specify the interface.
- -n: Numeric output only
- Example:
- Commonly used flags:
- -4: Perform DNS lookup to retrieve ipv4 address associated with the hostname.
- -6: Perform DNS lookup to retrieve ipv6 address associated with the hostname.
- -d: Print debugging traces
- -W [time_in_seconds]: Wait for upto given seconds.
- Example:
- Commonly used flags
- -x: Find out the domain name associated with given ip
- [domain_name]: Display various DNS records associated with the specified domain.
- @[dns_server] : Send query to specified dns server
- +short: Display only the IP address
- Example:
- Commonly used flags
- -o: Output file for the response
- -L: Follow redirection
- —dns-servers: Use different DNS server
- -k: Allow insecure connections
- Example:
- Commonly used flags:
- -O: Specify output file
- —no-check-certificate:
- Example:
wget: Non-interactive download of files from the web which supports HTTP, HTTPS, and FTP protocols.Basic Syntax: wget [OPTIONS] URL
wget -O resp.txt <https://hihey.local>
curl: curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.Basic Syntax: curl [OPTIONS] URL
curl -ko test.txt <https://google.com>
#result
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 220 100 220 0 0 397 0 --:--:-- --:--:-- --:--:-- 397
dig: Utility to perform DNS lookups and displays the answers that are returned from the name servers.Basic Syntax: dig [OPTIONS] HOSTNAME
dig -x 98.137.11.164
#result
; <<>> DiG 9.16.1-Ubuntu <<>> -x 98.137.11.164
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25747
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;164.11.137.98.in-addr.arpa. IN PTR
;; ANSWER SECTION:
164.11.137.98.in-addr.arpa. 5 IN PTR media-router-fp73.prod.media.vip.gq1.yahoo.com.
;; Query time: 564 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Tue Jun 06 07:16:08 UTC 2023
;; MSG SIZE rcvd: 115
-----------------------------------
dig +short secnep.com
#results
173.249.56.96
host: It is a simple DNS lookup utility which performs lookup on internet address.Basic Syntax: host [OPTIONS] HOSTNAME
host -4d google.com
#Result
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 5 IN A 142.250.192.174
Received 44 bytes from 127.0.0.53#53 in 12 ms
Trying "google.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47472
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;google.com. IN AAAA
Received 28 bytes from 127.0.0.53#53 in 8 ms
Trying "google.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64465
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;google.com. IN MX
;; ANSWER SECTION:
google.com. 5 IN MX 10 smtp.google.com.
Received 49 bytes from 127.0.0.53#53 in 8 ms
ping: Send ICMP ECHO_HOSTS to network hosts. It is generally used to check connectivity between your local machine and remote host or IP address.Basic Syntax: ping [OPTIONS] HOST
ping -I ens33 google.com
#result
PING google.com (142.250.192.174) from 192.168.179.128 ens33: 56(84) bytes of data.
64 bytes from del11s11-in-f14.1e100.net (142.250.192.174): icmp_seq=1 ttl=128 time=23.4 ms
64 bytes from del11s11-in-f14.1e100.net (142.250.192.174): icmp_seq=2 ttl=128 time=21.3 ms
----------------
ping -c 1 google.com
PING google.com (142.250.192.174) 56(84) bytes of data.
64 bytes from del11s11-in-f14.1e100.net (142.250.192.174): icmp_seq=1 ttl=128 time=71.7 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 71.735/71.735/71.735/0.000 ms