
[記事紹介] Linux システムのトラブルシューティング コマンド
CPU を最も多く消費しているプロセスを表示するにはどうすれば
$ ps H -eo pid,pcpu | sort -nk2 | tail
最もCPUを使用するプロセスの PID に対応するサービス名
$ ps aux | fgrep 30914
or
$ ll /proc/30914
dmesg
sudo dmesg
dmesg -n <level>

sudo dmesg -n 3
uname
uname -srvmpio
Linux 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 09:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
strace
strace -c ls -R
プロセスがさまざまな種類のシステムコールに費やした時間を報告します。これは、ルーチンを最適化して速度を上げたい場合や、予想よりも時間がかかっているプロセスを把握したい場合に役立ちます。出力は次のようになります。
top
top

-> Sort processes
top -o +%MEM
top -o +%CPU
-> List threads
top -H -p 24009
マウント
最近、よくSNSなどでも聞かれるようになった「マウント」ゴリラのマウンティングから来ているようですが、コンピューター技術者にとってはドライブをソフトウェア的に接続することを指します。
マウント ポイントとファイル システムのコンテキストでは、トラブルシューティングには通常、システム ログの確認、マウント ポイントの検証、正しいデバイスが正しい場所にマウントされていることの確認が含まれます。
mountpoint /mnt/mydisk
journalctl -e SYSLOG_IDENTIFIER=mount-s3
ネットワーク
1. ifconfig Command
$ ifconfig eth0
LinuxでIPアドレスとゲートウェイを設定する
eth0を有効にする
eth0を無効にする
2. Ping Command
N 回の要求 (成功またはエラー応答) の後に、オプション exit を指定して ping を実行します(-c)。
ping -c 5 www.tecmint.com
3. トレースルートコマンド
# traceroute 4.2.2.2
4. Netstat コマンド
# netstat -r
5. ディグコマンド
# dig www.tecmint.com; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 <<>> www.tecmint.com
6. Nslookup コマンド
# nslookup www.tecmint.com
7. ルートコマンド
# route add -net 10.10.10.0/24 gw 192.168.0.1
# route del -net 10.10.10.0/24 gw 192.168.0.1
# route add default gw 192.168.0.1
8. host コマンド
# host -t CNAME www.redhat.com
9. Arp コマンド
# arp -e
10. Ethtool コマンド
ethtool はmii-toolの代替
# ethtool eth0
11. Iwconfig Command
# iwconfig [interface]
12. Hostname Command
# hostname
いいなと思ったら応援しよう!
