LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-10-2009, 03:58 PM   #1
z-vet
Member
 
Registered: Aug 2004
Location: Israel
Distribution: Ubuntu 10.10
Posts: 271

Rep: Reputation: 34
Question SOLVED: Setting terminal colors with setterm?


Hi all.
Problem: i would like to change terminal's font color to green instead of default grey.
I know that i need to run setterm right before showing the login prompt, so i tried to put 'setterm -foreground green -store' in /etc/rc.local - it changes the color but does it in current VC only and doesn't work in others (and i want all six VC's to have a green font). Theoretically it can be done with /etc/inittab (correct me if i'm wrong), but i can't remember how to put the setterm command in there. Googled all day long without result, so any help is appreciated.

PS:
Please notice that i don't mean colors of PS1, 'ls' etc. - it's already done - but color of login prompt right after boot, so don't waste your time telling me about .bashrc and escape sequences.

Last edited by z-vet; 04-11-2009 at 03:03 PM.
 
Old 04-11-2009, 09:26 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Try to put the following line in /etc/rc.local then reboot:
Code:
echo -en \\033[32m\\033[8] > /dev/console
 
1 members found this post helpful.
Old 04-11-2009, 02:42 PM   #3
z-vet
Member
 
Registered: Aug 2004
Location: Israel
Distribution: Ubuntu 10.10
Posts: 271

Original Poster
Rep: Reputation: 34
Well, i solved it:

Run setterm which clears the screen and changes the console font color (here - to «old-school» bold green as i like) before login prompt. 'man setterm' for all you can do with it.

Open /etc/inittab and find this block of code:

Code:
1:2345:respawn:/sbin/getty 38400 tty1
  2:23:respawn:/sbin/getty 38400 tty2
  3:23:respawn:/sbin/getty 38400 tty3
  4:23:respawn:/sbin/getty 38400 tty4
  5:23:respawn:/sbin/getty 38400 tty5
  6:23:respawn:/sbin/getty 38400 tty6

Add the following right after 'getty' on each line:

Code:
-I `setterm -clear all -foreground green -bold -store`

So it looks like this:

Code:
1:2345:respawn:/sbin/getty -I `setterm -clear all -foreground green -bold -store` 38400 tty1
2:23:respawn:/sbin/getty -I `setterm -clear all -foreground green -bold -store` 38400 tty2
3:23:respawn:/sbin/getty -I `setterm -clear all -foreground green -bold -store` 38400 tty3
4:23:respawn:/sbin/getty -I `setterm -clear all -foreground green -bold -store` 38400 tty4
5:23:respawn:/sbin/getty -I `setterm -clear all -foreground green -bold -store` 38400 tty5
6:23:respawn:/sbin/getty -I `setterm -clear all -foreground green -bold -store` 38400 tty6
Reboot, enjoy.
 
Old 05-01-2009, 04:15 PM   #4
z-vet
Member
 
Registered: Aug 2004
Location: Israel
Distribution: Ubuntu 10.10
Posts: 271

Original Poster
Rep: Reputation: 34
Nope, i try to find it by myself. I'll post it here if i solve it too.
 
Old 09-14-2010, 07:13 PM   #5
Chris Modesto
LQ Newbie
 
Registered: Sep 2010
Location: Greece
Distribution: Fedora
Posts: 1

Rep: Reputation: 0
I know this is an old thread. But because I found a solution based on colucixs' post, I replied.

I got green letters on every tty by adding:

echo -en "\\033[32m\\033[8]" > /dev/tty1
echo -en "\\033[32m\\033[8]" > /dev/tty2
echo -en "\\033[32m\\033[8]" > /dev/tty3
echo -en "\\033[32m\\033[8]" > /dev/tty4
echo -en "\\033[32m\\033[8]" > /dev/tty5
echo -en "\\033[32m\\033[8]" > /dev/tty6

in /etc/rc.local

Last edited by Chris Modesto; 09-14-2010 at 07:22 PM.
 
  


Reply

Tags
colors, fonts, setterm, terminal


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting - Directory / File colors for SSH terminal connections young_rhkid Linux - Newbie 5 08-27-2011 07:39 AM
Terminal Colors carlosinfl Debian 8 03-20-2008 04:53 PM
Terminal Colors carlosinfl Debian 7 02-22-2008 05:41 AM
colors in terminal cad Linux - General 1 01-03-2007 01:27 AM
Terminal Colors chakkerz Linux - General 2 11-22-2004 10:01 PM


All times are GMT -5. The time now is 07:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration