• systemctl status service-name

  • journalctl -u service-name.service

systemctl status

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
➜ systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-01-10 15:00:35 XXX; 30min ago
       Docs: man:nginx(8)
   Main PID: 754 (nginx)
      Tasks: 2 (limit: 835)
     Memory: 10.8M
     CGroup: /system.slice/nginx.service
             ├─754 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─757 nginx: worker process

journalctl

1
2
3
4
5
6
7
8
9
➜ sudo journalctl -u nginx -b
-- Logs begin at Sat 2022-04-09 08:33:34 XXX, end at Wed 2022-07-13 16:21:51 XXX. --
Jul 13 15:49:35 10-7-63-91 systemd[1]: Starting A high performance web server and a reverse proxy server...
Jul 13 15:49:35 10-7-63-91 nginx[687]: nginx: [warn] conflicting server name "some.domain.com" on 0.0.0.0:80, ignored
Jul 13 15:49:35 10-7-63-91 nginx[687]: nginx: [warn] conflicting server name "www.domain.com" on 0.0.0.0:80, ignored
Jul 13 15:49:35 10-7-63-91 nginx[687]: nginx: [warn] conflicting server name "domain.com" on 0.0.0.0:80, ignored
Jul 13 15:49:35 10-7-63-91 nginx[743]: nginx: [warn] conflicting server name "www.domain.com" on 0.0.0.0:80, ignored
Jul 13 15:49:35 10-7-63-91 nginx[743]: nginx: [warn] conflicting server name "domain.com" on 0.0.0.0:80, ignored
Jul 13 15:49:35 10-7-63-91 systemd[1]: Started A high performance web server and a reverse proxy server.
  • -u --unit=UNIT Show logs from the specified unit

  • -b --boot[=ID] Show current boot or the specified boot

Ref