I sometimes cat a c file or a JSON file, there is no colorful format text.
Is there any command line tool that can show colorful format text as it is in ex: gedit?
Asked
Active
Viewed 110 times
0
Kusalananda
- 320,670
- 36
- 633
- 936
Mark K
- 779
- 2
- 13
- 33
-
This might be helpful: https://superuser.com/questions/117841/when-reading-a-file-with-less-or-more-how-can-i-get-the-content-in-colors – Peregrino69 Mar 29 '23 at 06:19
-
The solution seems to open a `vi`, in this way, I think I can use `vim` directly. – Mark K Mar 29 '23 at 06:23
-
Strange. I just installed and tested. I don't know how you do it, but my `less` now colorizes output? `vi` doesn't open. There's also a SO posting specifically for [colorizing cat with pygments](https://stackoverflow.com/questions/7851134/syntax-highlighting-colorizing-cat). EDIT tested that, and yes, `ccat` produces colorized output. – Peregrino69 Mar 29 '23 at 06:40
-
sorry, maybe it is not using `vi`, just use a new window to display. – Mark K Mar 29 '23 at 06:46
-
I think `pygmentize` solved this issue, thanks. – Mark K Mar 29 '23 at 06:48
-
Happy to be of help :-) – Peregrino69 Mar 29 '23 at 06:52
-
Look at bat https://github.com/sharkdp/bat – paradroid Mar 30 '23 at 00:59
1 Answers
1
TThe Several Linux commands:
Pygmentize: https://pygments.org/docs/cmdline/
Highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php
Stan SKY
- 42
- 4
-
1Please don't provide link-only answers. The intent behind this site is to become a repository of answers for future reference in case the original source goes away. – roaima Mar 29 '23 at 22:58
-