Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
12-28-2023, 12:13 PM
|
#1
|
Member
Registered: Apr 2021
Posts: 146
Rep: 
|
colourize crontab -l
with comments are shown with an ugly yellow background.
can the output colours be customized?
Thanks
|
|
|
12-28-2023, 12:57 PM
|
#2
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,195
|
Quote:
Originally Posted by jt1122
with comments are shown with an ugly yellow background.
can the output colours be customized?
Thanks
|
Almost everything can be customized, if one is willing to work at researching how.
I might start with saying that you can STRIP color by filtering through something that does not color. Example: For more than that we might need to know what shell you are using, in what terminal program, under what version and release of which distribution of Linux, and a few other details.
|
|
|
12-29-2023, 08:00 AM
|
#3
|
Member
Registered: Apr 2021
Posts: 146
Original Poster
Rep: 
|
Thanks.
Using Debian Testing + bash 5.2.21(1) .
|
|
|
12-29-2023, 01:57 PM
|
#4
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,195
|
That narrows it down to one of (I think) 14 terminal emulation terminal programs depending upon what GUI (if any) you might have chosen to install. For each there are also multiple settings and environment variables that might impact colors in display. Several of them allow you to specifically set the colors, hue and saturation, for multiple classes of foreground, background highlighting, bold, etc. Have you looked for settings information in the man page for your specific terminal program?
|
|
|
01-02-2024, 07:25 AM
|
#5
|
LQ Newbie
Registered: Nov 2013
Location: Europe/Poland
Distribution: Debian Sid
Posts: 3
Rep:
|
It looks like it's the feature of crontab:
Quote:
Originally Posted by man crontab
The -l option causes the current crontab to be displayed on standard output. When the output is a tty, comment lines are colored to distinguish them from action lines.
|
How to prevent crontab from displaying the colored comments?
|
|
|
01-02-2024, 10:09 AM
|
#6
|
Member
Registered: Apr 2021
Posts: 146
Original Poster
Rep: 
|
Quote:
Originally Posted by morfik
How to prevent crontab from displaying the colored comments?
|
...or customize the colour being used for comments.
|
|
|
01-02-2024, 02:13 PM
|
#7
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,195
|
Quote:
Originally Posted by morfik
It looks like it's the feature of crontab:
How to prevent crontab from displaying the colored comments?
|
See #2. Pipe through cat (or anything else) and the STDOUT for the command is the pipe, not a tty, so it does not color.
Also, if you change the terminal type to one that does not support color for that command you will get no color.
If it is the same ls that I use, try
Last edited by wpeckham; 01-02-2024 at 02:15 PM.
|
|
|
01-03-2024, 03:19 AM
|
#8
|
LQ Newbie
Registered: Nov 2013
Location: Europe/Poland
Distribution: Debian Sid
Posts: 3
Rep:
|
I think I'll wait for the support of the NO_COLOR var in cron:
Quote:
Release 1.5.7
...
crontab: switch off colors if NO_COLOR is set
|
Last edited by morfik; 01-03-2024 at 03:21 AM.
|
|
|
01-03-2024, 06:17 PM
|
#9
|
Senior Member
Registered: Aug 2016
Posts: 3,345
|
Quote:
Originally Posted by morfik
It looks like it's the feature of crontab:
How to prevent crontab from displaying the colored comments?
|
use something like
Code:
crontab -l | grep -v "#"
since all the comments should have the '#' at the beginning of the line
|
|
|
01-05-2024, 08:45 AM
|
#10
|
Senior Member
Registered: Dec 2011
Location: Simplicity
Distribution: Mint/MATE
Posts: 3,040
|
ITYM
Code:
crontab -l | grep -v "^#"
to skip just the crontab comments (and not shell commands with a #).
But I prefer to only prevent the coloring, as already suggested:
|
|
|
01-05-2024, 10:52 AM
|
#11
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,311
|
Quote:
Originally Posted by morfik
It looks like it's the feature of crontab:
Code:
The -l option causes the current crontab to be displayed on standard output. When the output is a tty, comment lines are colored to distinguish them from action lines.
How to prevent crontab from displaying the colored comments?
|
You need to read a bit further:
Quote:
When listing a crontab on a terminal the output will be colorized
unless an environment variable NO_COLOR is set.
|
But probably it depends on the exact version of the tool. Using pipe (like crontab -l | cat) will solve it too.
|
|
|
01-05-2024, 02:32 PM
|
#12
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,195
|
Note that environment variables CAN be set IN the crontab file almost as if it were a script, and they will exist and have effect ONLY during the cron run that uses that crontab file and ONLY for that crontab file's processes.
|
|
|
01-06-2024, 11:42 AM
|
#13
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,850
|
Quote:
Originally Posted by jt1122
Thanks.
Using Debian Testing + bash 5.2.21(1) .
|
Seems like this is a Debianism. For what it's worth, " crontab -l" produces simple text output on OpenSUSE; no colored comments. And no environment variables needed either.
Unless you really need to see the comments, perhaps you could define an alias that executes " crontab -l | grep -v '#'" or piping the output to cat as computersavvy suggested.
|
|
|
All times are GMT -5. The time now is 05:05 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|