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.
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?
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.
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.
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.
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..
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.