0
0
Linux CLIscripting~15 mins

dmesg for kernel messages in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Using dmesg to View Kernel Messages
📖 Scenario: You are a system administrator who wants to check the system's kernel messages to troubleshoot hardware or driver issues.
🎯 Goal: Learn how to use the dmesg command to view kernel messages and filter them by keywords.
📋 What You'll Learn
Use the dmesg command to display kernel messages
Create a variable to store the output of dmesg
Filter kernel messages containing the word usb
Print the filtered messages
💡 Why This Matters
🌍 Real World
System administrators often need to check kernel messages to diagnose hardware or driver problems on Linux servers or desktops.
💼 Career
Knowing how to use <code>dmesg</code> and filter its output is a basic skill for Linux system troubleshooting and monitoring.
Progress0 / 4 steps
1
Capture Kernel Messages
Run the command dmesg and save its output to a variable called kernel_messages.
Linux CLI
Need a hint?

Use command substitution with $( ) to save the output of dmesg into a variable.

2
Set Filter Keyword
Create a variable called filter_keyword and set it to the string usb.
Linux CLI
Need a hint?

Assign the string usb to the variable filter_keyword using double quotes.

3
Filter Kernel Messages
Use grep with the variable filter_keyword to filter kernel_messages and save the result to a variable called filtered_messages.
Linux CLI
Need a hint?

Use echo to send kernel_messages to grep and save the output.

4
Display Filtered Messages
Print the contents of the variable filtered_messages to display the filtered kernel messages.
Linux CLI
Need a hint?

Use echo to print the variable filtered_messages.