Glam Prestige Journal

Bright entertainment trends with youth appeal.

I am new to Linux OS. I was trying to add custom colors to my terminal using LS_Colors Project on Github

I installed the package using sh install.sh from the repo.

And it says, To enable the colors, add the following line to your shell's start-up script:

For Bourne shell (e.g. ~/.bashrc or ~/.zshrc):

 . "/home/username/.local/share/lscolors.sh"

How and where do I edit that script?

This is my bashrc file

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/username/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then eval "$__conda_setup"
else if [ -f "/home/username/anaconda3/etc/profile.d/conda.sh" ]; then . "/home/username/anaconda3/etc/profile.d/conda.sh" else export PATH="/home/username/anaconda3/bin:$PATH" fi
fi
unset __conda_setup
# <<< conda initialize <<<
3

3 Answers

From terminal run:

echo '. "/home/abi/.local/share/lscolors.sh"' >> ${HOME}/.bashrc

This assumes that your user uses default shell on Ubuntu which is bash.

For other shells you need to find out proper initialization file location.

man {shell name}

e.g.:

man zsh

After you add this line to your shell initialization script make sure you re-read this file, in case of bash invoke:

. ${HOME}/.bashrc

This solution can be improved still, i.e. you should check if lscolors initialization file exist before you source it in your shell's initialization file, to do that you should open your shell's initialization file in your favorite text editor (geany/gedit/nano/vim/emacs) and add following lines:

if [ -f "${HOME}/.local/share/lscolors.sh" ] ; then . "${HOME}/.local/share/lscolors.sh"
fi

do as the instructions say,

You can use nano to add that lines to your .bashrc file. I recommend putting it in the last line, so you can easily find it in the future

nano ~/.bashrc
1

Firstly see which shell you are using:

ps -p $$ | grep usr.* --color

Then open rc file: .<your shell>rc. For bash it will be .bashrc, for tcsh - .tcshrc. Add "~/" at the beginning of .bashrc as a shortcut to your home directory.

gedit ~/.bashrc

You will be able to edit it in "gedit" text editor. Then save and close the gedit window and run:

source ~/.bashrc

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy