Open In App

colcrt command in Linux with examples

Last Updated : 25 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

colcrt command in Linux systems is used to format the text processor output so that it can be viewed on Cathode Ray Tube displays. It removes underlining, strike-throughs, and underscores, which can’t be displayed on CRTs since only one character can be produced at a given location on the CRT screen. It also places all the underscores on a new line, right under the original line.

Here, we will cover the syntax, usage examples, and options available for the colcrt command.

Syntax

colcrt [-] [-2] [file ...]
  • file: The file to be processed by colcrt.
  • – and 2: Command-line options that modify the behavior of the command.

Note: For this article, we will be using the below-mentioned files to show the outputs of the colcrt command.

GFG_1:

geeksforgeeks.c

Common Options for colcrt Command

1. colcrt command with help option:

The help option of colcrt command displays the usage/syntax of the colcrt command. This is useful if you need a quick reminder on how to use the command.

colcrt -h

2. colcrt with ‘-‘ option:

When colcrt is used with ‘-‘ option, the resulting output has all the special formatting (such as strikethrough, underscore, etc.) removed.

Example 1:

colcrt - GFG_1

Example 2:

colcrt - geeksforgeeks.c

3. colcrt with ‘-2’ option:

When colcrt is used with ‘-2’ option, the resulting output has all the special formatting removed, with the underscores additionally being displayed in new lines. Also, a new empty line is added after every line, which makes the output more easily readable.

Example 1:

colcrt -2 GFG_1

Example 2:

colcrt -2 geeksforgeeks.c

Conclusion

The ‘colcrt’ command is a specialized tool designed for CRT display compatibility, which may not be relevant in modern systems but is still useful for handling legacy text formatting issues. By stripping away unwanted formatting like underscores and strike-throughs, colcrt ensures that text can be displayed in environments where limited formatting is supported.


Next Article

Similar Reads

three90RightbarBannerImg