Typically when I'm editing a small file over SSH I'll just open up nano. I look at my apache2 access.log a good bit. Since I don't have fail2ban or anything enabled on this box, I typically look at access.log.1 as well. I've noticed in my access.log.(#) a particular line always has an odd highlighting:

GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1" 400 516 "-" "-" enter image description here

More things I've noticed:

  • This only happens if there is a .B or a .I in the line, and every letter after that on the line is red
  • This only happens in files that end in a number; it occurs in access.log.1, but not access.log. Same for any test.log.1
  • This only works for filename.1 through filename.9
  • From the line syntax "man" "\.[1-9]x?$" I get that files .1 through .9 are highlighted.. but why?

Apparently the files in /usr/share/nano handle syntax highlighting, After a bit of digging, I found out that one file in particular is responsible for this: man.nanorc. Here are the contents of it:

## Here is an example for manpages.
syntax "man" "\.[1-9]x?$"
color green "\.(S|T)H.*$"
color brightgreen "\.(S|T)H" "\.TP"
color brightred "\.(BR?|I[PR]?).*$"
color brightblue "\.(BR?|I[PR]?|PP)"
color brightwhite "\\f[BIPR]"
color yellow "\.(br|DS|RS|RE|PD)"

For files such as wp-config.php on a wordpress site, nano does syntax highlighting correctly. What is so special about .I and .B that makes the first character blue and the rest red, and what does this have to do with the .1?


With those syntax-highlighting rules files, nano assumes that filenames ending in .1 - .9 are man pages.

It's been quite a while since I edited a man page, but I'm pretty sure that in groff -man, .I is for italic and .Bis for bold.

| improve this answer | |
  • Is this for people creating man pages, or do some people add notes in their man pages? – cutrightjm Nov 9 '15 at 6:01
  • both, i guess. people can do both things, and it works for both. probably not very many people at all add notes to existing man pages but it's certainly possible. – cas Nov 9 '15 at 6:36
  • if you don't like it, comment out or delete those rules. and probably do it again after every update of the nano package. – cas Nov 9 '15 at 6:37
  • man pages, as noted. I edit mine manually, and recognized those characters. – Lizardx Nov 9 '15 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.