dmesg prints the kernel ring buffer, which contains messages related to the system's hardware, drivers, and kernel activity.
dmesg # Print all in kernel ring buffer
dmesg -k # Print only kernel messages
sysctl is used to change kernel parameters at runtime.
# Display all available kernel parameters and their current values
sysctl -a
# -w: Write or change a kernel parameter.
sysctl -w net.ipv4.ip_forward=1
# -p: Load settings from a file (default is /etc/sysctl.conf)
sysctl -p
A command to query and view logs from systemd-journald
# Display all logs from the beginning of history
journalctl
# Filter logs by date
journalctl --since "2024-09-01" --until "2024-09-04"
# Display log from sshd service
journalctl -u sshd.service
# Monitor logs in real-time
journalctl -f
# Display only kernel logs
journalctl -k
The traditional logging mechanism used in Unix and Linux systems.
/var/log/messages: General system messages./var/log/syslog: Similar to messages but more verbose (on some systems)./var/log/auth.log: Authentication-related messages./var/log/kern.log: Kernel messages.