Wednesday, January 14, 2009

Redirecting MAN pages to file - linux


If we try normal bash redirection to redirect a man page to a file, the output file will produce many unreadable** characters.

So in order to redirect we need to use col command (which filter reverse line feeds from input)

$ man ls | col -bx > /tmp/ls.man

Where:

col - filter reverse line feeds from input
-b Do not output any backspaces, printing only the last character written to each column position.
-x Output multiple spaces instead of tabs.

** In my Ubuntu 7.10, normal redirection of man pages work fine, but in my debian 3.0 desktop, or in the cygwin shell, normal redirection does not work.

Related post:

- How to open man pages in vi editor - Linux
- Redirect top command output to a file

No comments:

© Jadu Saikia www.UNIXCL.com