![]() |
[SOLVED] Terminal emulator & GRUB coloring - Printable Version +- Linux Lite Forums (https://www.linuxliteos.com/forums) +-- Forum: General (https://www.linuxliteos.com/forums/forumdisplay.php?fid=4) +--- Forum: Suggestions and Feedback (https://www.linuxliteos.com/forums/forumdisplay.php?fid=13) +--- Thread: [SOLVED] Terminal emulator & GRUB coloring (/showthread.php?tid=1345) Pages:
1
2
|
Re: [SOLVED] Terminal emulator & GRUB coloring - anon222 - 05-04-2015 Perhaps we could change some colors Code: leafpad $HOME/.bashrc Code: if [ $USER = 'root' ]; then ![]() Perhaps white bold would better match the current theme Code: if [ $USER = 'root' ]; then Re: [SOLVED] Terminal emulator & GRUB coloring - Valtam - 05-04-2015 Misko, that is a great idea. Having root as either bold or a different color just makes sense. Re: [SOLVED] Terminal emulator & GRUB coloring - gold_finger - 05-04-2015 I like that idea too, Misko. Re: [SOLVED] Terminal emulator & GRUB coloring - riser - 05-04-2015 Code: I'm surprised people have not been doing this within their profiles. I've had my terminal colors and PS1 set for years across distros. # Fancy PWD display function ################################################## # The home directory (HOME) is replaced with a ~ # The last pwdmaxlen characters of the PWD are displayed # Leading partial directory names are striped off # /home/me/stuff -> ~/stuff if USER=me # /usr/share/big_dir_name -> ../share/big_dir_name if pwdmaxlen=20 ################################################## bash_prompt_command() { # How many characters of the $PWD should be kept local pwdmaxlen=25 # Indicate that there has been dir truncation local trunc_symbol=".." local dir=${PWD##*/} pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen )) NEW_PWD=${PWD/#$HOME/\~} local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen )) if [ ${pwdoffset} -gt "0" ] then NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen} NEW_PWD=${trunc_symbol}/${NEW_PWD#*/} fi } bash_prompt() { case $TERM in xterm*|rxvt*) local TITLEBAR='\[\033]0;\u:${NEW_PWD}\007\]' ;; *) local TITLEBAR="" ;; esac local NONE="\[\033[0m\]" # unsets color to term's fg color # regular colors local K="\[\033[0;30m\]" # black local R="\[\033[0;31m\]" # red local G="\[\033[0;32m\]" # green local Y="\[\033[0;33m\]" # yellow local B="\[\033[0;34m\]" # blue local M="\[\033[0;35m\]" # magenta local C="\[\033[0;36m\]" # cyan local W="\[\033[0;37m\]" # white # empahsized (bolded) colors local EMK="\[\033[1;30m\]" local EMR="\[\033[1;31m\]" local EMG="\[\033[1;32m\]" local EMY="\[\033[1;33m\]" local EMB="\[\033[1;34m\]" local EMM="\[\033[1;35m\]" local EMC="\[\033[1;36m\]" local EMW="\[\033[1;37m\]" # background colors local BGK="\[\033[40m\]" local BGR="\[\033[41m\]" local BGG="\[\033[42m\]" local BGY="\[\033[43m\]" local BGB="\[\033[44m\]" local BGM="\[\033[45m\]" local BGC="\[\033[46m\]" local BGW="\[\033[47m\]" local UC=$W # user's color [ $UID -eq "0" ] && UC=$R # root's color #PS1="$TITLEBAR ${EMG}[${UC}$(date +%H:%M:%S) ${UC}\u${EMB}@${UC}\h ${EMG}\${NEW_PWD}${EMB}]${UC}\\$ ${NONE}" PS1="$TITLEBAR ${G}[${C}\d \t \h ${G}\${NEW_PWD}]${UC}\\$ ${NONE}" # without colors: PS1="[\u@\h \${NEW_PWD}]\\$ " # extra backslash in front of \$ to make bash colorize the prompt } PROMPT_COMMAND=bash_prompt_command bash_prompt unset bash_prompt Re: [SOLVED] Terminal emulator & GRUB coloring - LL-user - 05-04-2015 Great idea, Misko, especially considering newcomers to Linux would be a bit overwhelmed in having to figure that out. I have configured it myself. BUT I definitely would prefer it coming out of the box this way. In addition to this and even more important for me would be to implement that broken links are shown in a different color like this: ![]() The last couple of days I have extensively worked with softlinks and it was a huge hassle with the default setting not showing valid and broken links in different colors. Thanks, riser, for sharing! Re: [SOLVED] Terminal emulator & GRUB coloring - anon222 - 05-05-2015 (05-04-2015, 05:02 AM)Jerry link Wrote: Misko, that is a great idea. Having root as either bold or a different color just makes sense.It's logical. (05-04-2015, 05:18 PM)gold_finger link Wrote: I like that idea too, Misko.I think it would be helpfull. Some other distros use this by default. (05-04-2015, 08:17 PM)riser link Wrote: I'm surprised people have not been doing this within their profiles. I've had my terminal colors and PS1 set for years across distros.Thanks for sharing riser. + (05-04-2015, 10:08 PM)LL-user link Wrote: Great idea, Misko, especially considering newcomers to Linux would be a bit overwhelmed in having to figure that out.LL-user everything is customizable. Those who remember DOS would easily adapt. ![]() I think those os us who use the terminal more often would like to have some colors. Those who don't probably think it's too geeky. ![]() Thanks for your suggestion. We'll see about that. Re: [SOLVED] Terminal emulator & GRUB coloring - LL-user - 05-05-2015 I'm just using the default color settings. So the setup only needs one step, i.e. putting the following code into /etc/bash.bashrc: Code: if [ -f $HOME/.dir_colors ]; then Re: [SOLVED] Terminal emulator & GRUB coloring - anon222 - 05-05-2015 I like that. No need for the eval here though. Code: if [ -f $HOME/.dir_colors ]; then Re: [SOLVED] Terminal emulator & GRUB coloring - Valtam - 06-29-2015 Have started working on LL 2.6, here is what I have for the root prompt, with a caution: ![]() Re: [SOLVED] Terminal emulator & GRUB coloring - LL-user - 07-10-2015 Hi Jerry, Good idea to give an additional heads up. I just did a test installation of Fedora and very much like their approach, a one time, extended warning at the beginning: ![]() |