31

I am completely new to Linux.

I know that dmesg and journalctl record commands invoked by my operating-system, but why do 2 recorders exist, what types of messages should I expect to see within each of them, and what are the differences in their life cycles?

Rimski
  • 433
  • 1
  • 4
  • 7

1 Answers1

12

They are two totally different things.

On most systems that I'm aware of that has dmesg, it is sometimes a command and sometimes a log file in /var/log, and may be both. The log contains messages produced by the kernel. This will usually include the various device probe messages during the boot sequence as well as any further messages outputted by the kernel during the running of the system.

Depending on what "journal" refers to, I suppose it way be different things. The journal that first springs to my mind is the journal of a journaled filsystem. This journal contains the various transactions made to a particular partition (part of a disk) and allows the system to replay disk operations consistently in the case of a system crash. This journal is not generally accessible to users.

If "journal" refers to journalctl, then the two are similar, but not the same. journalctl has a --dmesg option that makes it mimic dmesg.

Compare the manuals for journalctl and dmesg on your system.

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
  • 4
    >If "journal" refers to journalctl, then the two are similar, but not the same. journalctl has a --dmesg option that makes it mimic dmesg. Mind adding more detail what are the diffs? Rimski asked what are the differences and directing them to the manpages doesn't answer the question – walnut_salami Dec 02 '21 at 19:46
  • 1
    This answer could be improved a lot. A more complete answer can be found here: https://www.reddit.com/r/redhat/comments/n3b278/can_someone_briefly_explain_the_major_differences/ – EricS Dec 23 '21 at 15:35
  • 2
    @EricS I'm not entirely mistaken, you should be able to suggest edits to the answer. It would also give you the opportunity to change it in the way that your personally prefer. It would be appreciated. – Kusalananda Dec 23 '21 at 16:14