LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 07-19-2012, 04:19 PM   #1
Dornith
Member
 
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153

Rep: Reputation: Disabled
Make console text green


I wanted to make the console text green on my Slackware machine. I found the command "setterm -foreground green", but I can't find any way to make it come up any sooner that the log-in, and after I do something like dir, it switches back. Is there any way to make the console green from the start and stay that way?
 
Old 07-19-2012, 04:21 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
PS1 prompt I think is what you are looking for.

Heres some stuff on arch linux but it should translate to slackware without any modifications:

https://wiki.archlinux.org/index.php/Color_Bash_Prompt
 
Old 07-19-2012, 04:49 PM   #3
Dornith
Member
 
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153

Original Poster
Rep: Reputation: Disabled
I don't know if that did anything or not since I already have it green partly so it might have been redundant, but it didn't fix either of my two problems. It's still white when loading and after I use dir.
 
Old 07-19-2012, 05:05 PM   #4
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
I'm not sure I follow you..

Your PS1 prompt is specific to each user and is an environment variable associated with that shell. You would have to log out and log back in our source your .bashrc file for the changes to take effect.


Can you give us some example of where the colors are not displaying properly? You say when you use dir? What does that mean.
 
Old 07-19-2012, 05:09 PM   #5
Dornith
Member
 
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153

Original Poster
Rep: Reputation: Disabled
It's while when it's loading all the information and up until the log in. Then, once I log in, it's green. But after I do a command, such as dir, the the text color switches back to white.
 
Old 07-19-2012, 05:20 PM   #6
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
dir colors are set by another variable, LS_COLORS. See the dircolors man page for more info on that.

The boot information will be in the default prompt and will not be what you set for your users .bashrc PS1 prompt.
 
Old 07-19-2012, 05:24 PM   #7
Dornith
Member
 
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153

Original Poster
Rep: Reputation: Disabled
I don't want to change the dir colors, I want it to not change after dir.

And I know that what I set for the users will not apply to the boot. That's why I'm posting this question asking what does.
 
Old 07-19-2012, 05:33 PM   #8
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
The command dir uses its own variable to determine your colors. The LS_COLORS variable, it is not changing your PS1 prompt simply referencing a different variable.

I don't think you can modify the boot text color..
 
Old 07-19-2012, 05:35 PM   #9
Dornith
Member
 
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153

Original Poster
Rep: Reputation: Disabled
Yes, it is. I'll have a green prompt, I type "dir" and press enter, it shows the directory, and from there on I have a white prompt.
 
Old 07-19-2012, 05:48 PM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
To get the kernel messages at boot in a different color you have to change a file in the kernel and recompile it. Search for the file vc.c in the kernel source tree. In that file, somewhere around the line 2865 you will find this line:
Code:
 vc->vc_def_color       = 0x07;   /* white */
Change the 7 to 2 and recompile the kernel. If you boot this kernel you should get the kernel messages in green.
After the init-scripts take over, this will most likely revert this change, so you have to edit the init-scripts to get green output.

I don't know how to change the behavior for the change after commands, like ls, that change the colors themselves.
 
1 members found this post helpful.
Old 07-19-2012, 06:16 PM   #11
Dornith
Member
 
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
To get the kernel messages at boot in a different color you have to change a file in the kernel and recompile it. Search for the file vc.c in the kernel source tree. In that file, somewhere around the line 2865 you will find this line:
Code:
 vc->vc_def_color       = 0x07;   /* white */
Change the 7 to 2 and recompile the kernel. If you boot this kernel you should get the kernel messages in green.
After the init-scripts take over, this will most likely revert this change, so you have to edit the init-scripts to get green output.

I don't know how to change the behavior for the change after commands, like ls, that change the colors themselves.
That is exactly what I was looking for. I can't find the vc.c file though (there's a lot of files here), do you know where I can find it?

Edit: Never mind. I figured out why my file search couldn't find it. It was set to only look in the home directory.

Last edited by Dornith; 07-19-2012 at 06:22 PM.
 
Old 07-19-2012, 06:21 PM   #12
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 592

Rep: Reputation: 140Reputation: 140
seems The wrong architecture :-(
Code:
bash-4.2$ slocate "/vc.c"
/usr/src/linux-3.4/arch/arm/mach-omap2/vc.c
/usr/src/linux-3.2.13/arch/arm/mach-omap2/vc.c

Last edited by whizje; 07-19-2012 at 06:24 PM.
 
Old 07-19-2012, 06:25 PM   #13
nixblog
Member
 
Registered: May 2012
Posts: 426

Rep: Reputation: 52
The following has worked for Debian in the past by adding the following to /etc/rc.local,

Code:
echo -en "\\033[32m\\033[8]" > /dev/tty1
This will give you green text in tty1 at login - repeat for other ttys if necessary. You will need a restart for it to take effect if I remember rightly.

Last edited by nixblog; 07-19-2012 at 06:28 PM.
 
1 members found this post helpful.
Old 07-19-2012, 06:31 PM   #14
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 592

Rep: Reputation: 140Reputation: 140
Found it.
Quote:
Originally Posted by TobiSGD View Post
I found out that it is rather simple to change the color of the kernel messages (if you know how to compile a kernel). In your kernel source tree open the file drivers/tty/vt.c with a text editor and search for the function vc_init. inside it you will find the line
Code:
vc->vc_def_color       = 0x07;   /* white */
Change that to 0x02 instead, recompile the kernel and if you boot that kernel you will get green messages.
No I have to look if those colors can be customized, I want amber or at least something similar looking.
 
Old 07-19-2012, 08:41 PM   #15
Dornith
Member
 
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153

Original Poster
Rep: Reputation: Disabled
Okay, I did a search of the folder where the Linux source files were and found no such vc.c.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change light green text color to dark green of xterm ? cola Slackware 13 01-03-2010 10:07 AM
How to make boot up text + console full screen Cantremember Linux - Newbie 1 04-11-2009 09:16 PM
How can I make text smaller in console? nflenz Linux - General 5 02-09-2006 08:45 AM
Konqueror's "text view" option makes text green. newtwolinux SUSE / openSUSE 2 08-26-2005 07:45 AM
make OpenBSD's text console larger? gani *BSD 4 09-21-2004 12:44 AM


All times are GMT -5. The time now is 04:33 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration