ccat-Use syntax to highlight output

ccat is a command line tool similar to the cat command in Linux , which displays the content of the file and highlights the programming language syntax of Javascript, Java, Go, Ruby, C, Python, and Json.

To install the ccattool in Linux , you need to make sure that the wgettool is installed. The following is the installation wgetcommand:

# The following is the installation command in Centos /RHEL/Fedora. 
yum -y install wget 
# The following is the installation command in Ubuntu/Deepin/Debian. 
apt -y install wget

Download the compressed package of ccat from github below:

[root@localhost ~]# wget https://github.com/owenthereal/ccat/releases/download/v1.1.0/linux-amd64-1.1.0.tar.gz

Unzip, and copy the Jiang binary file to the /usr/local/bindirectory:

[root@localhost ~]# tar xvf linux-amd64-1.1.0.tar.gz 
[root@localhost ~]# cd linux-amd64-1.1.0/
[root@localhost linux-amd64-1.1.0]# cp -p ccat /usr/local/bin/

In order to test the function of ccat against the system configuration file, check several configuration files in Linux below.

[root@localhost ~]# ccat /etc/sysconfig/network-scripts/ifcfg-ens160 
[root@localhost ~]# ccat /etc/fstab 

ccat-Use syntax to highlight output content ccat-Use syntax to highlight output content
Here is how to ccatreplace the cattool and /etc/bashrcadd a cat alias to the file:

# Centos/RHEL/Fedora
[root@localhost ~]# echo "alias cat='/usr/local/bin/ccat'" >> /etc/bashrc 
[root@localhost ~]# source /etc/bashrc 
# Ubuntu/Deepin/Debian
$ sudo echo "alias cat='/usr/local/bin/ccat'" >> /etc/profile
$ sudo source /etc/profile

ccatThe tool can also be used to display multiple files and output them in HTML format, as shown in the following example:

[root@localhost ~]# ccat --html /etc/sysconfig/network-scripts/ifcfg-ens160 /etc/sysconfig/iptables /etc/fstab > /var/www/html/ccat.html

ccat-Use syntax to highlight output content ccat-Use syntax to highlight output content
You need to install a web server such as apache or nginx to view it on the web page. Or you can open the .html file in the graphical interface.

to sum up

ccat is a command line tool similar to the cat command in Linux, which displays the content of the file and highlights the programming language syntax of Javascript, Java, Go, Ruby, C, Python, and Json.

Guess you like

Origin blog.csdn.net/yaxuan88521/article/details/114478043