Edit Linux man pages with gmanedit
I can't tell you how many times I have used a man page only to find either an error (due to author not updating) or that the man page itself was confusing and needing my own personal tweaking. Now, if you are unsure as to what a man page is, you should know that Linux is installed with numerous help files for just about every command and/or program installed on your machine. To access a man (short for "manual") page you would simply issue the command man APPLICATION Where APPLICATION is the name of the command or application you want to run.
Of course man pages are written in a format called troff. It's not overly complicated and something you can easily get used to. But some times you don't need to know the format to make a few minor changes. I have used this system many times to make notes in man pages (so when/if I have to refer back to them I don't have to depend upon a fading memory) that aren't necessary for all users (otherwise I would submit them to the maintainer). Now, after reading this article (and thanks to gmanedit), you will be able to edit your Linux man pages as well.
As you would expect, installation is simple. All you have to do is follow these steps:
- Open up your Add/Remove Software utility.
- Search for "gmanedit" (no quotes).
- Select gmanedit for installation.
- Click Apply to install.
There may be some dependencies to meet for the installation. But more than likely you will already have those met. Now, let's get to using this handy tool.
In order to edit/save man pages you will have to open up gmanedit with root privileges. So open it up from command line by either first su'ing to root or using sudo. The command to start is gmanedit. When you open up gmanedit you will see a fairly minimal interface. Although it looks like a standard, basic text editor, there is a bit more under the hood than that. For instance, the man pages you will be editing are typically in the tar.gz form. And by using this tool you do not have to unpack the files, edit the files, and repack the files. You simply open them, edit them, and save them.
The first tiny hiccup you might encounter is that, when you go to open up a man page, you won't know where to look. Fear not...man pages are housed in /usr/share/man. Within that directory you will see numerous sub-directories. The directories you want to focus on are manX (Where X is a number). The only downfall of this system is that you might have to poke around within those directories to find the man page you need. Once you find the page, and have it open, it will look like that in Figure 1.
Obviously you will see the troff formatting - which might make you want to turn away. But - when you see the standard wording of the man page you might see sections you want/need to change. All you need to do is make your changes and save the man page. Now when you issue the man command your changes will be there.
At first you might not see the handi-ness of this system, but after you use it for a while you will see how nice it is to be able to put your own personal notes within man pages - or be able to help the maintainers of man pages with issues.Advertisement