AWS EC2 (Ubuntu) で不具合調査するときによく使う Linux コマンドたち

AWS EC2 (Ubuntu) で不具合調査するときによく使う Linux コマンドたち

毎度のように調べているので。楽にコピペできるように自分用メモ。

# Switch to root user
sudo su -

# Show user-data file
cat /var/lib/cloud/instance/user-data.txt

# Show cloud-init log
cat /var/log/cloud-init-output.log

# Show service file
systemctl cat my-awesome.service

# Show service status
systemctl status my-awesome.service

# Show the last 50 lines of the journal for the service (current boot)
journalctl -u my-awesome.service -b -n 50

# Show the first 50 lines of the journal for the service (current boot)
journalctl -u my-awesome.service -b --reverse | tail -n 50

# Follow service log in real-time
journalctl -u my-awesome.service -f