Linux col Command
The Linux col command is used to filter control characters.
In many UNIX documentation files, there are RLF control characters. When we use the shell special characters ">" and ">>" to output the content of the documentation files into plain text files, control characters become garbled. The col command can effectively filter out these control characters.
Syntax
col [-bfx][-l<buffer columns>]
Parameters:
-b Filters out all control characters, including RLF and HRLF.
-f Filters out RLF characters but allows HRLF characters to be displayed.
-x Represents tab characters with multiple space characters.
-l<buffer columns> The default memory buffer has 128 columns, and you can specify the buffer size yourself.
Example
Below is an example using the col command with the man command's help documentation.
Save the man command's help documentation as man_help, using the -b parameter to filter all control characters. Use the following command in the terminal:
man man | col -b > man_help
Note: The "|" is used to create a pipeline, converting the output of the man command into input data for the col command.