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.
|
 |
|
07-19-2012, 03:19 PM
|
#1
|
Member
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153
Rep: 
|
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?
|
|
|
07-19-2012, 03:21 PM
|
#2
|
Senior Member
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604
|
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
|
|
|
07-19-2012, 03:49 PM
|
#3
|
Member
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153
Original Poster
Rep: 
|
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.
|
|
|
07-19-2012, 04:05 PM
|
#4
|
Senior Member
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604
|
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.
|
|
|
07-19-2012, 04:09 PM
|
#5
|
Member
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153
Original Poster
Rep: 
|
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.
|
|
|
07-19-2012, 04:20 PM
|
#6
|
Senior Member
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604
|
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.
|
|
|
07-19-2012, 04:24 PM
|
#7
|
Member
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153
Original Poster
Rep: 
|
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.
|
|
|
07-19-2012, 04:33 PM
|
#8
|
Senior Member
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604
|
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..
|
|
|
07-19-2012, 04:35 PM
|
#9
|
Member
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153
Original Poster
Rep: 
|
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.
|
|
|
07-19-2012, 04:48 PM
|
#10
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
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.
|
07-19-2012, 05:16 PM
|
#11
|
Member
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153
Original Poster
Rep: 
|
Quote:
Originally Posted by TobiSGD
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 05:22 PM.
|
|
|
07-19-2012, 05:21 PM
|
#12
|
Member
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 594
Rep: 
|
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 05:24 PM.
|
|
|
07-19-2012, 05:25 PM
|
#13
|
Member
Registered: May 2012
Posts: 426
Rep: 
|
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 05:28 PM.
|
|
1 members found this post helpful.
|
07-19-2012, 05:31 PM
|
#14
|
Member
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 594
Rep: 
|
Found it.
Quote:
Originally Posted by TobiSGD
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.
|
|
|
|
07-19-2012, 07:41 PM
|
#15
|
Member
Registered: Jul 2012
Location: U.S.A
Distribution: Archlinux Multilib, Debian 7.0.0 32b
Posts: 153
Original Poster
Rep: 
|
Okay, I did a search of the folder where the Linux source files were and found no such vc.c.
|
|
|
All times are GMT -5. The time now is 08:32 AM.
|
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
|
|