Adding Colour to Solaris 10

I have spent hours trolling the net looking for a definitive guide on how to make colours (color if you are from the US) work in Solaris 10.

By default colour isn’t enabled but once you know how it is relativity easy to get it to work.

The first step is to download a number of new packages from www.sunfreeware.com the packages needed are as follows:

coreutils-8.19-sol10-sparc-local
gmp-4.2.1-sol10-sparc-local
libiconv-1.14-sol10-sparc-local
gcc-3.4.6-sol10-sparc-local
libgcc-3.3-sol10-sparc-local
libintl-3.4.0-sol10-sparc-local

After all the packages are downloaded and added to your Solaris machine it time to install them using pkgadd.

Get root on your machine and install the packages

su

pkgadd -d coreutils-8.19-sol10-sparc-local

Do this for each of the downloaded packages.

The next step is to test that colours are now working run the following command to check.

/usr/local/bin/ls –color    (this command assumes that you have installed the packages in the default location)

Now that colour is working we just need to modify the profile so that it always works.

Depending on your shell you may need to edit .profile for ksh or .bashrc for bash.

Update PATH by adding the new location to it:

export PATH=$PATH:/usr/local/bin

now if you run;

which ls

its should return /usr/local/bin/ls

add an alias to your profile to append –color to ls command

alias ls=’/usr/local/bin/ls –color’

Reload your profile and type ls, the results should return in colour.

The final section of this guide is to change the colour of your shell prompt you can do so by adding the folowing command to your profile

export PS1=”\e[0;35m\u@\h > \e[m”

You can set the colour to any of the below by editing the number;

Color Code
Black     0;30
Blue       0;34
Green    0;32
Cyan      0;36
Red        0;31
Purple  0;35
Brown  0;33
Blue      0;34
Green   0;32
Cyan    0;36
Red      0;31
Purple 0;35
Brown 0;33

You should now have a fully coloured SHELL prompt.


Posted

in

by

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.