LinuxCommandLibrary

Network

External IP

$ curl ifconfig.me
copy
$ dig +short myip.opendns.com @resolver1.opendns.com
copy
$ netcat icanhazip.com 80 <<< $'GET / HTTP/1.1\nHost: icanhazip.com\n' | tail -n1
copy

Get WiFi password

$ cat /etc/NetworkManager/system-connections/[SSID] | grep psk=
copy

List network interfaces

$ lspci | egrep -i --color 'network|ethernet'
copy
$ ifconfig -a
copy
$ ip link show
copy
$ lshw -class network
copy
$ cat /proc/net/dev
copy
$ nmcli device status
copy

Download file

$ wget [url]
copy
$ curl -O [url]
copy
$ aria2c [url]
copy
$ axel [url]
copy

Ping another device

$ ping [ip]
copy
$ mtr [ip]
copy

Telnet connection

$ telnet [ip] [port]
copy

List open sockets

$ netstat -l
copy
$ lsof -i
copy
$ ss -l
copy

Show open ports

$ ss -tuln
copy
$ netstat -tuln
copy

Test port connectivity

$ nc -zv [host] [port]
copy

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community