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 ccat
tool in Linux , you need to make sure that the wget
tool is installed. The following is the installation wget
command:
# 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/bin
directory:
[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
Here is how to ccat
replace the cat
tool and /etc/bashrc
add 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
ccat
The 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
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.