terminal output to file creates multiple duplicate characters

This has bugged me from time to time. When I try to send a terminal command to a file I will get a number of duplicated letters. For example, in Terminal I type "man defaults > ~/Desktop/filename.txt"

This is an example of what I get. Any idea's how to prevent this? Just need to do this sort of thing every once in a while. Has occurred in various OS's


Thanks in advance


Bill


ddeeffaauullttss [--ccuurrrreennttHHoosstt | --hhoosstt _h_o_s_t_n_a_m_e] { _d_o_m_a_i_n_s | find _w_o_r_d | _h_e_l_p }


DDEESSCCRRIIPPTTIIOONN

DDeeffaauullttss allows users to read, write, and delete Mac OS X user defaults

from a command-line shell. Mac OS X applications and other programs use the

defaults system to record user preferences and other information that must

MacBook Pro Retina

Posted on Aug 1, 2021 11:20 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 1, 2021 12:15 PM

You can get the man page into Preview as a PDF as leroydouglas shared, or you can do the following to produce a formatted text output:


groff -Tutf8 -man /usr/share/man/man1/defaults.1 | more

or

groff -Tutf8 -man /usr/share/man/man1/defaults.1 > ~/Desktop/defaults.txt


where the latter renders (abbreviated) in the text file as the following when viewed with the more pager, and not Quick Look which doubles the characters:



because in my Terminal preferences, I have set the bold text to that blue color for the bolded elements in the man page.


If you have to have a normal output text file to view in Quick Look:


man defaults | col -bx > defaults.txt



You could even just enter the man page name (e.g. defaults) on the command line, then right-click on it, and choose Open man Page from the contextual menu. That will pop open another custom profile Terminal window:


4 replies
Question marked as Top-ranking reply

Aug 1, 2021 12:15 PM in response to wrcooke

You can get the man page into Preview as a PDF as leroydouglas shared, or you can do the following to produce a formatted text output:


groff -Tutf8 -man /usr/share/man/man1/defaults.1 | more

or

groff -Tutf8 -man /usr/share/man/man1/defaults.1 > ~/Desktop/defaults.txt


where the latter renders (abbreviated) in the text file as the following when viewed with the more pager, and not Quick Look which doubles the characters:



because in my Terminal preferences, I have set the bold text to that blue color for the bolded elements in the man page.


If you have to have a normal output text file to view in Quick Look:


man defaults | col -bx > defaults.txt



You could even just enter the man page name (e.g. defaults) on the command line, then right-click on it, and choose Open man Page from the contextual menu. That will pop open another custom profile Terminal window:


Aug 1, 2021 12:00 PM in response to wrcooke

wrcooke wrote:

This has bugged me from time to time. When I try to send a terminal command to a file I will get a number of duplicated letters. For example, in Terminal I type "man defaults > ~/Desktop/filename.txt"
This is an example of what I get. Any idea's how to prevent this? Just need to do this sort of thing every once in a while. Has occurred in various OS's

Thanks in advance

Bill

ddeeffaauullttss [--ccuurrrreennttHHoosstt | --hhoosstt _h_o_s_t_n_a_m_e] { _d_o_m_a_i_n_s | find _w_o_r_d | _h_e_l_p }

DDEESSCCRRIIPPTTIIOONN
DDeeffaauullttss allows users to read, write, and delete Mac OS X user defaults
from a command-line shell. Mac OS X applications and other programs use the
defaults system to record user preferences and other information that must




I see the same error as given. Full stop.




What if you try a different approach from Terminal:


 man -t defaults | open -f -a Preview




or from your Safari browser, copy and paste:

x-man-page://defaults


Command S will save to your location of choice if this is what you want as well.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

terminal output to file creates multiple duplicate characters

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.