Linux
Command
Library
GitHub
F-Droid
Google Play Store
Basics
Tips
Commands
Network
Interfaces & IP Addresses
ip
is the modern tool for everything interface-related;
ifconfig
is its deprecated predecessor.
a
is short for
addr
.
$
ip
a
copy
$
ip
link show
copy
$
nmcli
device status
copy
$
ifconfig
-a
copy
Identify the network hardware behind the interfaces.
$
lspci
|
grep
-i 'network\|ethernet'
copy
$
lshw
-class network
copy
$
ethtool
eth0
copy
Configuring Interfaces
Bring interfaces up or down and assign addresses manually (root required). Changes made with
ip
are gone after a reboot; make them permanent in your network manager.
$
ip
link set eth0 up
copy
$
ip
link set eth0 down
copy
$
ip
addr add 192.168.1.50/24 dev eth0
copy
Release the DHCP lease and request a new one.
$
dhclient
-r eth0
copy
$
dhclient
eth0
copy
Wi-Fi
With NetworkManager,
nmcli
scans, connects, and even reveals the password of the current network.
$
nmcli
device wifi list
copy
$
nmcli
device wifi connect [SSID] password [password]
copy
$
nmcli
device wifi show-password
copy
Stored Wi-Fi passwords live in NetworkManager's connection files (root required).
$ sudo
grep
-r "psk=" /etc/NetworkManager/system-connections/
copy
On systems using iwd instead of NetworkManager, use
iwctl
.
$
iwctl
station wlan0 get-networks
copy
$
iwctl
station wlan0 connect [SSID]
copy
External IP
Your public address as seen from the internet, via HTTP or DNS.
$
curl
ifconfig.me
copy
$
dig
+short myip.opendns.com @resolver1.opendns.com
copy
Testing Connectivity
ping
checks if a host answers,
traceroute
shows the path packets take, and
mtr
combines both in a live view.
$
ping
[host]
copy
$
ping
-c 4 [host]
copy
$
traceroute
[host]
copy
$
tracepath
[host]
copy
$
mtr
[host]
copy
Check whether a specific TCP port is reachable.
$
nc
-zv [host] [port]
copy
$
telnet
[host] [port]
copy
Measure raw throughput between two machines (run
iperf3 -s
on one,
-c
on the other).
$
iperf3
-s
copy
$
iperf3
-c [serverIp]
copy
DNS Lookups
Resolve names to addresses and back.
dig +short
prints just the answer;
-x
does a reverse lookup of an IP.
$
dig
[domain]
copy
$
dig
+short [domain]
copy
$
dig
-x [ip]
copy
$
dig
MX [domain]
copy
$
host
[domain]
copy
$
nslookup
[domain]
copy
$
resolvectl
query [domain]
copy
Look up who owns a domain or IP range.
$
whois
[domain]
copy
Downloading Files
wget
downloads and resumes,
curl -O
saves under the remote name (
-L
follows redirects),
aria2c
and
axel
split downloads over parallel connections.
$
wget
[url]
copy
$
wget
-c [url]
copy
$
curl
-LO [url]
copy
$
aria2c
[url]
copy
$
axel
[url]
copy
Open Ports & Sockets
ss
replaces netstat:
-t
TCP,
-u
UDP,
-l
listening,
-n
numeric,
-p
show the owning process (root for all processes).
$
ss
-tulpn
copy
$
netstat
-tuln
copy
$
lsof
-i
copy
$
lsof
-i :80
copy
Routing
Show the routing table, and ask which route (and source address) would be used to reach a destination.
$
ip
route
copy
$
ip
route get 1.1.1.1
copy
$
route
-n
copy
Bandwidth Usage
Live traffic per connection (
iftop
), per process (
nethogs
), per interface (
nload
,
bmon
), and long-term statistics (
vnstat
).
$
iftop
copy
$
nethogs
copy
$
nload
copy
$
bmon
copy
$
vnstat
copy
Hostname
$
hostname
copy
$
hostnamectl
copy
$
hostnamectl
set-hostname [newName]
copy
Copied to clipboard
Kai
AltStyle
によって変換されたページ
(->オリジナル)
/
アドレス:
モード:
デフォルト
音声ブラウザ
ルビ付き
配色反転
文字拡大
モバイル