Thursday, May 23, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1337  / 2 Years ago, wed, may 18, 2022, 10:02:18

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 <<<

More From » command-line

 Answers
7

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

[#2184] Thursday, May 19, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
girdleas

Total Points: 1
Total Questions: 112
Total Answers: 114

Location: Lesotho
Member since Wed, Jun 2, 2021
3 Years ago
girdleas questions
;