Problems rarely occur with Linux, but that doesn’t mean the operating system is immune to problems. Sometimes I install new services or apps and start them with the following command:
sudo systemctl start name
Where NAME is the name of your app or service.
Related article: The first 5 Linux commands every new user should learn
Services may not start or run properly. When that happens, where do you go? You can always check the log file (usually a good place to start) or use another related command. system ctl. That command is journal ctl.
of journal ctl This command queries the systemd journal and lists the contents of the journal, which may contain insight into why a particular app or service is not performing properly. Often when I try to start a service, system ctlIf the service does not start properly (or at all), the output should include journal ctl Command to find out what happened.
Describes how to use this command. That way, you won’t have to worry about figuring out why things aren’t going as planned.
How to use journal ctl
What you need: All you need for this task is a Linux distribution that uses systemd. This is most of the major distributions.
journal ctl
What you see is the entire systemd journal output. The output may provide information that can help you troubleshoot the problem.
When I ran the command, the output was only 41 lines. I’ve seen examples where the output contained hundreds of lines. So using the command without arguments or options was a bit unhelpful.
Related article: 10 Linux apps I install on every new machine (and why you should too)
Fortunately, much of that noise can be filtered out.
For example, I’m having trouble starting SSH. To troubleshoot this issue, you can run the following command:
See more
systemctl -u ssh
in this case, -u represents unitor a specific systemd unit (think of it as a “service”).
Related article: How to create system restore points using Timeshift on Linux – and why you should do it
The output of the above command will look like this:
Jan 12 09:55:42 Pop-os systemd[1]: Starting OpenBSD Secure Shell server…
Jan 12 09:55:42 Pop-os sshd[3424]: The server is listening on 0.0.0.0 port 22.
Jan 12 09:55:42 Pop-os sshd[3424]: The server is listening on :: port 22.
Jan 12 09:55:42 Pop-os systemd[1]: Started the OpenBSD Secure Shell server.
Jan 15 09:39:26 Pop-os sshd[659190]: invalid user jackwallen from 192.168.1.77 port 55040
Jan 15 09:39:29 pop OS sshd[659190]: pam_unix(sshd:auth): Check the path. User unknown
Jan 15 09:39:29 pop OS sshd[659190]: pam_unix(sshd:auth): Authentication failed; log name= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.77
January 15th 09:39:31 popos sshd[659190]: Invalid password for user jackwallen from 192.168.1.77 port 55040 ssh2 failed
January 15th 09:39:33 popos sshd[659190]: Connection closed by invalid user jackwallen 192.168.1.77 port 55040 [preauth]
Jan 15 09:39:39 pop OS sshd[659232]: accepted jack password from 192.168.1.77 port 55049 ssh2
Jan 15 09:39:39 pop OS sshd[659232]: pam_unix(sshd:session): Session opened for user jack(uid=1000) by (uid=0)
As you can see, in my case SSH is running as expected, but the login attempt fails (because I forgot to add a valid username when logging in from my iMac).
There’s a better way to troubleshoot your service. journal ctl. Let’s say SSH is running, but you’re having trouble accepting connections (or any other issue you may encounter). You can make the output “tail” (print real-time information as it occurs), like this:
See more
journal tcl -xefu ssh
This command not only informs you of the startup and running status of a service, but also lists the most recent entries recorded in the journal for that service. To close, use the Ctrl+c keyboard shortcut. For those who want to know, here is an explanation of the options.
- x – Adds a description to the log line from the message catalog.
- e – Immediately jump to the end of the journal in the implicit pager tool
- f – follow (continuously prints new entries logged)
- u – units (as explained above)
You can also display a specific time range journal ctl. Suppose you only want to see entries logged since 10am on January 20th. The command will look like this:
See more
Journalctl –since “2025-01-20 10:00:00”
All entries logged from 10 a.m. to now are displayed.
Related article: How to keep Linux optimized (and save time) with Stacer
You can also make the scope more specific. Suppose you want to display entries logged between 10 AM and 10:10 AM. The command will look like this:
journalctl –since “2025-01-20 10:00:00” –until “2025-01-20 10:05:00”
That’s how you use it journal ctl To troubleshoot app startup issues on Linux.