Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Please pardon me if this is the wrong forum. It seems like a simple, fundamental issue - the type which often confuse me.
I am playing with a security scanner called lynis which produces a very nicely formatted and color coded output when I run it at the command line. I now have a LOT of work to do to harden my computer. That said, I would like to get this output into some sort of editor with which I could print it or mark it up as I fix various issues. I can redirect > or tee the output of a lynis scan to a file. So far, so good.
If I cat the file it displays the color coding in the terminal. However, if I open it in a GUI text editor or Libre Office writer I see some gibberish representing the color coding but no color.
lynis may provide some reporting tools. I will look into that. Stil, when I capture std out with color coding from lynis or any other source I would like to have a way to make use of it. Any suggestions?
The escape sequences you see is what allows there to be colour in the terminal. Commands like cat and less can continue to show the characters in the deisred colour as they are also outputting
to the terminal.
Once you open the file in an editor, you are no longer at the terminal but the escape sequences which produce the colours are now visible.
As the program you open the file in is not the terminal, it would not make sense for the characters to work and you have done nothing to remove them and hence
they appear.
Your alternative would be to tell Lynis to do one verion in colour so you can admire it and a second version without colour so you can work on it in your editor
I can simply cat the log in a terminal and scroll back and forth. Unfortunately less does not respect the color coding. I may try colorize-logs but I am not at that point yet. I started studying the lynis results at random - looking for places with a lot of red - and found that I had a boatload of old kernels still installed. Apparently autoremove in Ubuntu 20.04 does not correctly remove old kernels. Neither would several scripts and tools I found in my research. I finally ripped the remnants of old kernels out manually with sudo apt remove --purge (kernel).
Now I see that the vast majority of my systemd services are [UNSAFE} I think I need to beat down those concerns before I print out my results for some nighttime reading.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.