LoginSignup
3
2

More than 3 years have passed since last update.

ネットワーク系コマンドチートシート(Linux)

Last updated at Posted at 2019-11-03
  • Debian10 で動くはずです
  • macOS版はこちら

インターフェースのup/down

sudo ip link set eth0 up

LISTENしているポートの一覧を表示する

netstatを使う場合

netstat -ant
  • -n 名前解決をしない
  • -t TCPポートを表示

ssを使う場合

ss -lt4
  • -l LISTEN中のソケットを表示
  • -t TCPソケットを表示
  • -4 IPv4を表示

ssでポートをLISTENしているプロセスも表示する

  • root権限が必要
sudo ss -ltp4

現在のネットワークの帯域を見たい

kbpsをざっくりと表示する

prev_b=0; while :; do b="$(cat /proc/net/dev | grep ppp0 | sed 's/^ *//' | tr -s ' ' | cut -d ' ' -f 10)"; echo "$(((b - prev_b) * 8 / 1000))"; prev_b=$b; sleep 1; done
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2