Configure Linux to save past dmesg logs

Modified on Wed, 16 Aug, 2023 at 9:47 AM


In order to collect information about previous boots, including system crash logs, it can be useful to configure the system to save previous boot and kernel logs.

You can see the logs from the current boot in Linux by running the command:

$ journalctl -k


By default, Linux doesn’t save logs from past boots so if the system has been rebooted, all that information is lost.

To enable the ability to save previous logs, edit the journalctl config file:

$ sudo nano /etc/system/journald.conf

 Add the line ‘Storage=persistent

A screenshot of a computer program 
Description automatically generated

Once this is done, the system will begin saving the logs each time the system is rebooted.

To view a list of previous boots logged, you can use the command

$ journalctl –-list-boots


This will display a list of previous boots in chronological order. The time and date of each boot listed on the right, and the left column shows the offset from the last boot; -1, -2, -3, etc

A black screen with white text

Description automatically generated


You can view the log of a specific boot by adding it as an argument to the command, for example:

$ journalctl -k -b -1

You can replace the number at the end with the offset seen in the left column of the desired boot.

To save the output to a file you can use the command

$ journalctl -k -b -1 –-no-pager > dmesg.log





More information on using journalctl can be found here:




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article