dmesg with colored human-readable dates

dmesg -T|sed -e 's|\(^.*'`date +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g'
Use sed to color the output of a human-readable dmesg output

21
By: jlaunay
2012-07-31 22:21:07

What Others Think

With sed it's easy to choose the bash color to use ;34 here for blue. You can also use grep to highlight the date instead of sed. dmesg -T| grep --color "^\[.*`date +%Y`\]" And export the GREP_COLORS variable to change the color. ex : export GREP_COLORS="fn=34:mc=01;30:ms=33:sl=21:cx=31"
jlaunay · 608 weeks and 2 days ago
dmesg -T works on my archlinux but on my debian server option -T does not exist. You can use perl if your dmesg does not support -T : dmesg|perl -ne "BEGIN{\$a= time()- qx!cat /proc/uptime!};s/\[\s*(\d+)\.\d+\]/localtime(\$1 + \$a)/e; print \$_;" | sed -e 's|\(^.*'`date +%Y`' \)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g'
jlaunay · 608 weeks and 2 days ago
Not working on CentOS: dmesg: invalid option -- T
dynaguy · 608 weeks and 1 day ago
-T option to dmesg is available on Fedora but not RHEL5/6.
foobrew · 608 weeks and 1 day ago
@dynaguy so as said on my previous comment on CentOS you should try : dmesg|perl -ne "BEGIN{\$a= time()- qx!cat /proc/uptime!};s/\[\s*(\d+)\.\d+\]/localtime(\$1 + \$a)/e; print \$_;" | sed -e 's|\(^.*'`date +%Y`' \)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g' If you get the error : bash: !}: event not found You need to turn off bash history substitution with : set +H
jlaunay · 608 weeks and 1 day ago
@jlaunay I just tried on CentOS 6.3 64bit. After "set +H" there is no more error message. But your command still doesn't give time stamp.
dynaguy · 608 weeks ago
Recent CentOS use rsyslog. What I did is edit /etc/rsyslog.conf, add: kern.* /var/log/kern.log then "service rsyslog restart" Now you can view dmesg in file /var/log/kern.log with time/data
dynaguy · 608 weeks ago
@dynaguy Good to know if I have to use CentOS one day.Thks
jlaunay · 608 weeks ago
"dmesg -T" gives: "dmesg: invalid option -- 'T' Usage: dmesg [-c] [-n level] [-r] [-s bufsize]"
mpb · 608 weeks ago
@mpb you should have a look at the previous comments. I gave an alternative usefull on OS using a dmesg which doesn't support the -T option.
jlaunay · 608 weeks ago
@dynaguy -- no need to turn off bash history substitution. Change the bangs to ':'. The bangs are simply used as delimiters to the qx function, and were simply chosen as a character which wouldn't conflict with all of the other possible delimiters being used in the expression being quoted. Using ':' instead doesn't cause the history substitution problems...
bartonski · 607 weeks and 6 days ago
@dynaguy -- no need to turn off bash history substitution. Change the bangs to ':'. The bangs are simply used as delimiters to the qx function, and were simply chosen as a character which wouldn't conflict with all of the other possible delimiters being used in the expression being quoted. Using ':' instead doesn't cause the history substitution problems...
bartonski · 607 weeks and 6 days ago
dmesg |ccze -A
kxdemon · 578 weeks and 4 days ago
The commands are pretty hard to execute themselves. But this one gave me an idea just how, I should have check this out soooner. Thanks!!!
freykarts · 158 weeks and 1 day ago
I was so glad to see the details regarding the commands you have shared here. Through such commands you can check this out perform various kinds of tasks that you want. The dmesg command is used with the colored human readable dates. Keep sharing more details here..
Alyssalauren · 112 weeks and 4 days ago
Your post is great. it rends me more owner info. I will follow your next posts, keep posting quality articles. sedecordle wordle
danielusa · 89 weeks and 4 days ago
How about you. I often use it on quordle moviedle it's very convenient.
lanikane68 · 83 weeks and 1 day ago
Good to know this tip for using CentOS. wordle getting over it
robertusa0106 · 75 weeks and 4 days ago
Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under $500 Near Me pug puppies for sale in texas pug puppies for sale $200 pugs for sale near me under $500 pugs for sale under $400 near me pugs for sale near me puppies for sale near me under $500 pug puppies for sale under $1,000 near me pug for sale pug puppies for sale under $300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under $500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies baby pug puppies for sale pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale $200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
Perfecthomepugs · 74 weeks ago
Paint your nails with the chosen polish colors, using thin, even strokes. Allow the polish to dry completely before applying a second coat, if needed. anime nails Once the polish is dry, you can add any additional nail art elements, such as stickers, decals, or hand-painted designs. Finish off your anime nails with a top coat to seal in the polish and protect your nail art. If you're not confident in your nail art skills, you can try using nail wraps or stickers with anime designs, or visit a nail salon to have your anime nails done by a professional.
hehena · 64 weeks ago
The commands Pokemon Showdown that you need to execute will be much more complex than simply a command as you share.
kevintexas0106 · 54 weeks ago
The command you provided uses dmesg -T to display the dmesg output with human-readable dates, Infinite Fusion Calculator, and then pipes it to sed to add color to the output. The sed command matches the lines with the date format and adds color to the date portion using ANSI escape codes.
johndavidd88 · 42 weeks and 1 day ago
I have bookmarked your blog, the articles are way better than other similar blogs.. thanks for a great blog! PhenQ Weight Loss
Digitalwork · 38 weeks and 3 days ago
Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. Active Keto Gummies Reviews
Digitalwork · 36 weeks and 4 days ago
Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Career Assessment
Digitalwork · 36 weeks ago
Perfect House Of Pugs acquired a passion for animals, and the Pug puppy in particular, at a young age since I grew up in a house with lots of dogs. It was a natural ability to know how to grow, nurture, and care for animals. I knew what the future held when I met my wife, who essentially had the same enthusiasm as I have. Being a breeder is more of a passion for me than a profession since I get to witness people's faces light up when they successfully adopt a pug puppy from our facility. It is not possible to find happiness in anything else. PLEASE VISIT OUR WEBSITE LINK BELLOW FOR MORE INFORMATION ABOUT PUG PUPPIES. PUG PUPPY ADOPTION Pug puppies for sale PUG PUPPIES FOR SALE NEAR ME PUG PUPPIES NEAR ME PUG PUPPIES FOR SALE UNDER 500 NEAR ME CUTE PUG PUPPIES BLACK PUG PUPPIES BLACK PUG PUPPIES FOR SALE PUG PUPPIES FOR ADOPTION BLACK PUG PUPPIES FOR SALE NEAR ME CHIHUAHUA PUG MIX PUPPIES TEACUP PUG PUPPIES HOW MUCH IS A PUG PUPPY BABY PUG PUPPIES PICTURES OF PUG PUPPIES PUG PUPPIES FOR SALE IN OHIO PUG PUPPIES FOR SALE IN PA PUG PUPPIES PRICE PUG MIX PUPPIES TEACUP PUG PUPPIES FOR SALE BABY PUG PUPPIES FOR SALE BEST FOOD FOR PUG PUPPY NEWBORN PUG PUPPIES PUG PUPPIES CRAIGSLIST PUG PUPPIES FOR SALE CRAIGSLIST WHITE PUG PUPPIES PUG PUPPIES FOR SALE IN MICHIGAN PUG PUPPIES FOR SALE UNDER 500 ADORABLE PUG PUPPIES BRINDLE PUG PUPPY HOW MUCH DOES A PUG PUPPY COST PITBULL PUG MIX PUPPIES PUGS FOR SALE NEAR ME PUG PUPPIES FOR SALE 200 PUG PUPPIES FOR SALE IN NJ PUG PUPPIES FOR SALE IN WISCONSIN PUG PUPPIES MICHIGAN PUG PUPPY COST MERLE PUG PUPPY FOR ADOPTION BEST PUG PUPPY FOOD ROYAL CANIN PUG PUPPY FOOD FAWN PUG PUPPY PUG PUPPIES FOR SALE FLORIDA PUG PUPPIES FOR SALE IN INDIANA PUG PUPPIES FOR SALE IN KY PUG PUPPIES FOR SALE IN NC PUG PUPPIES FOR SALE IN TEXAS PUG PUPPIES FOR SALE MN PUG DOG PUPPY AKC REGISTERED PUG PUPPIES FOR SALE PUG ALL BLACK CHEAP PUG PUPPIES FOR SALE NEAR ME PUGS PUPPIES FOR SALE CHEAP PUG PUPPIES FOR SALE IN CALIFORNIA MINIATURE PUG PUPPIES FOR SALE NEAR ME MINIATURE PUG PUPPIES FOR SALE CHEAP PUG PUPPIES FOR SALE IN NJ KNOWN FACTS ABOUT PUG PUPPIES ADOPT PUG PUPPIS RECUE A PUG PUPPY PERFECT HOUSE OF PUGS PUG PUPPIES INSTAGRAM PINTEREST QUORA Google Page USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA
pugpuppies95 · 35 weeks and 5 days ago
Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot. I was exploring this particular info for a long time. Thanks to this blog my exploration has ended. gwinbola
Digitalwork · 34 weeks ago
Wordle is an online game that challenges players to guess a five-letter word within six attempts. Each guess is met with color-coded feedback: green for correct letters in the right position, yellow for correct letters in the wrong position, and gray for incorrect letters. The objective is to decode the hidden word using these clues. play NYT Wordle and Improve Your Vocabulary. Also, Play wordle 2 Game Online Daily.
wordlenyt · 29 weeks and 3 days ago
Hello, this weekend is good for me, since this time i am reading this enormous informative article here at my home. Local SEO Corby
Digitalwork · 26 weeks and 2 days ago
Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing. MCPE Apk
tecnggossip452 · 23 weeks and 2 days ago
TIMUR188 Bukan hanya sekedar memberikan statement sebagai situs tergacor 2023 saat ini, kami membuktikan dengan memberikan jaminan garansi gacor 100% atau biasa di sebut garansi kekalahan 100%. Yang di mana apabila member baru deposit dan mengalami kekalahan pertamanya maka member berhak mengklaim garansi kekalahan 100% sesuai dengan syarat dan ketentuan yang berlaku. Menarik kan ? Main slot kalah dan bisa klaim kembali saldo nya. Promo ini hanya berlaku untuk member yang baru melakukan deposit untuk pertama kali nya. Cara klaim nya juga sangat mudah sekali. Member hanya perlu melapor ke CS Livechat TIMUR188 yang bertugas 24 jam dimana fitur klaim garansi nya terdapat di bagian pojok kanan bawah di halaman situs kami. Gabung sekarang juga jangan sampai ketinggalan promo bonus menarik yang sudah ditawarkan, segera klik langsung tombol yang disediakan diatas untuk bergabung dengan Situs TIMUR188 yang sudah kami Bagikan
wandasuwari · 10 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: