Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Ccat under Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use Ccat under Linux", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use Ccat under Linux" this article.

1. Install Ccat

1) the ccat command is available directly in AUR, so if you have an AUR assistant on your system, you can install it directly. Arch systems, for example, can be installed directly using the yay command.

The Arch user software repository, commonly referred to as the AUR,AUR helper, is a wrapper that allows users to install packages from the AUR repository without manual intervention.

$yay-S ccat

2) in other Linux distributions, you need to compile and install ccat, as follows:

Download the source archive package using the following command

$wget https://github.com/jingweno/ccat/releases/download/v1.1.0/linux-amd64-1.1.0.tar.gz

Extract the downloaded archive file

$tar xfz linux-amd64-1.1.0.tar.gz

Copy the ccat executable file to system $PATH (for example, / usr/local/bin/)

$sudo cp linux-amd64-1.1.0/ccat / usr/local/bin/

Finally, use chmod to add executable permissions to the ccat command

$sudo chmod + x / usr/local/bin/ccat

two。 How to use ccat to shade cat commands

The method of using ccat is very similar to the cat command, so here are some examples.

Let's first look at the text file, such as hello.c, with the cat command.

$cat hello.c

The effect is as follows

Cat

You can see that the code does not have any color markings (you should be familiar with this result). Now, use ccat to look at the text file hello.c and see how it displays the output.

$cat hello.c

The effect is as follows:

Ccat

Have you noticed the difference? ccat uses syntax to highlight the output, while the cat command displays the output only in the system's default theme color.

We can also display the output of more than one file at a time, as shown below.

$ccat test.txt example.txt

For some reason, you may want to display the output in HTML format. To do this, simply add the "- html" option at the end.

$ccat test.txt-html

Not only the local file, we can also display the contents of the file directly on the network as follows.

$curl https://raw.githubusercontent.com/jingweno/ccat/master/main.go | ccat

To see the default code color, run the following command.

$ccat-palette

Of course, you can set your own color code as follows.

$ccat-G String= "_ fuchsia_"-G Plaintext= "darkteal" hello.c

Ps: you may encounter the following error during the download step

Ccat_error

This is because github upgraded openssl and disabled tlsv1.1. You only need to update the native openssl and git tools to solve the problem.

3. Replace cat in the system

If you like ccat and want to replace the default cat command with ccat, all you need to do is create an alias.

If you installed it from AUR in Arch Linux, add the following line to the ~ / .bashrc file.

Alias cat=ccat

If installed from a compiled binary, add the following line to the ~ / .bashrc file.

Alias cat=/usr/local/bin/ccat

Finally, run the following command for the changes to take effect.

$source ~ / .bashrc

To add it system-wide (this command is available to all users), add the above entry to the / etc/bashrc (on RPM-based systems) or / etc/profile (on Debian-based systems) file.

The above is all the contents of the article "how to use Ccat under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report