CCAT – use syntax to highlight output

Time:2021-12-5

CCAT is a command line tool similar to the cat command in Linux. The command displays the contents of the file and highlights the programming language syntax of JavaScript, Java, go, ruby, C, Python and JSON.
To install the CCAT tool in Linux, you need to ensure that the WGet tool is installed. The following is the command to install WGet:
CCAT – use syntax to highlight output

The following is the installation command in CentOS / RHEL / fedora.

yum -y install wget

Here are the installation commands for Ubuntu / deepin / Debian.

apt -y install wget
Download the compressed package of CCAT from GitHub:

[[email protected] ~]# wget https://github.com/owentherea…
Unzip and copy the binary file to the / usr / local / bin directory:

[[email protected] ~]# tar xvf linux-amd64-1.1.0.tar.gz
[[email protected] ~]# cd linux-amd64-1.1.0/
[[email protected] linux-amd64-1.1.0]# cp -p ccat /usr/local/bin/
In order to test the function of CCAT against the system configuration file, let’s look at several configuration files in Linux.

[[email protected] ~]# ccat /etc/sysconfig/network-scripts/ifcfg-ens160
[[email protected] ~]# ccat /etc/fstab
CCAT – use syntax to highlight output CCAT – use syntax to highlight output
Here is how to make CCAT replace the cat tool and add a cat alias in the / etc / bashrc file:

Centos/RHEL/Fedora

[[email protected] ~]# echo “alias cat=’/usr/local/bin/ccat'” >> /etc/bashrc
[[email protected] ~]# source /etc/bashrc

Ubuntu/Deepin/Debian

$ sudo echo “alias cat=’/usr/local/bin/ccat'” >> /etc/profile
$ sudo source /etc/profile
The CCAT tool can also be used to display multiple files and output them in HTML format, as shown in the following example:

[[email protected] ~]# ccat –html /etc/sysconfig/network-scripts/ifcfg-ens160 /etc/sysconfig/iptables /etc/fstab > /var/www/html/ccat.html
CCAT – use syntax to highlight output CCAT – use syntax to highlight output
You need to install a web server such as Apache or nginx to view it on the web page. Or open the. HTML file in the graphical interface.

summary
CCAT is a command line tool similar to the cat command in Linux. The command displays the contents of the file and highlights the programming language syntax of JavaScript, Java, go, ruby, C, Python and JSON.

Recommended Today

The real problem of Alibaba IOS algorithm can’t hang up this time

More and more IOS developers continue to enter the peak of job hopping in 2020 Three main trends of interview in 2020: IOS bottom layer, algorithm, data structure and audio and video development Occupied the main battlefield. Data structure and algorithm interview, especially figure, has become the main reason for the failure of most first-line […]