How to use ccat command In Linux
The syntax ccat is very simple. To display the content of single file syntax is as follows:
$ ccat FILE_NAME
Example:
$ ccat index.html
To display the content of a file from another directory, ccat has the following syntax:
$ ccat PATH_TO_FILE
Example:
$ ccat /var/db/Makefile
To display the content of multiple files, mention the file names after the ccat command:
$ ccat FILE_NAME1 FILE_NAME2
Example:
$ cat index.html main.cpp
Set Dark Background
To set dark background, use the –bg option with the ccat command:
$ ccat --bg=dark FILENAME
Example:
$ ccat --bg=dark index.html
We can also set the color codes to the syntax of the output of ccat. Here is one example:
To show the color palette of ccat uses the following command:
$ ccat --palette
ccat also provides another best feature is that it can show the output in the HTML form also. To show the output in the HTML format, use the –html at the end pf ccat command
$ ccat FILENAME --html
Example:
$ ccat main.cpp --html
If you open the output in the browser, then you will see the output as follows:
Ccat – Colorize Cat Command Output command in Linux with Examples
ccat is a command-line tool for Linux and OSX, which is similar to the cat command in Linux. But the difference between cat and ccat is that the ccat shows the content of the file with the syntax highlighted. Currently, ccat supports the following programming languages.
- JavaScript
- Java
- Ruby
- Python
- Go
- C
- JSON