man command output to a txt file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:

I am trying to outut the man command output into a text file which will help me for future reference.

  1. Relevant commands, code, scripts, algorithms:

man, cat

  1. The attempts at a solution (include all code and scripts):

man ls|cat >>ls.txt

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Self Learning. IT Professional.

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

man ls -P /bin/cat > ls.txt

Thank you for the reply.. I still get some special characters and it is not in readable format in txt files. How to remove it?

Try:

man ls | col -b > ls.txt

Am using bash sh. Am running cygwin tool in windows to practice unix.

Here is the output:

-bash: col: command not found
Error executing formatting or display command.
System command (cd "/usr/share/man" && (echo ".pl 11i";  /usr/bin/gunzip -c '/usr/share/man/man1/ls.1.gz') | /usr/bin/tbl |  /usr/bin/nroff -c -mandoc 2>/dev/null | /usr/bin/less -isrR) exited  with status 36096.
No manual entry for ls

---------- Post updated 06-18-12 at 01:34 AM ---------- Previous update was 06-17-12 at 11:42 AM ----------

Any other commands people?

what is your OS ?

 
man ls > ls.txt

OS is windows. I use Cygwin ( A unix terminal for windows) to practice Unix.

When i try this, I get the txt file with some unreadable characters. And I just want to organize the output to a proper format, so that I can either read it or print it in a paper to use it as a reference manual.

check whether it helps for you

manpage - Where is the 'man' Program for Windows (Program to open UNIX man pages)? - Stack Overflow

Groff for Windows

yesterday only, i uploaded all the man pages in my website. If you want the text files, then you can get it from here

thelinuxtips.com - Man Page

Also you can get it from here man(1) [opensolaris man page]

Thank you! Your tips site is great. I was looking for something like this actually.