LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-21-2012, 07:42 PM   #1
Sebi94
Member
 
Registered: Jun 2012
Posts: 34

Rep: Reputation: Disabled
Permanently edited prompt colors


Hello community!
I've got a question... I want to edit the prompt colors permanently. I've already edited the file /etc/bash.bashrc, which is the "globally bashrc". It work's already fine, but I don't want to send the command "source /etc/bash.bashrc" after each login, relogg or something else.

I want this prompt-configuration always on each user account. Is it possible to realize that and if yes: How?!

Thank you forwarding!

Best Regards
Sebastian
 
Old 07-21-2012, 08:39 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
The link below gives some useful information on the bash prompt. Making a change permanent is explained, scroll about half way down the page.

http://bash.cyberciti.biz/guide/Changing_bash_prompt
 
Old 07-22-2012, 06:39 AM   #3
Sebi94
Member
 
Registered: Jun 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
Thank you. It's very helpful, but I haven't got a .bashrc or .bash_profile in one of my home directories. I've got only this one: /etc/bash.bashrc

If I create a file called ".bashrc" in my home directory and add this line, it also doesn't work:
Quote:
Originally Posted by ~/.bashrc
export PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '
Is there an another solution?
 
Old 07-22-2012, 10:41 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Putting it in .bash_profile should work. .bash_profile is always loaded, while .bashrc is only loaded in special circumstances (something related to "login shells", IIRC).

BTW, which distribution are you using, that doesn't put a .bash_profile or .bashrc in all newly created accounts?

If you want the same prompt to be in all new accounts, then put the .bash_profile and/or.bashrc file(s) in /etc/skel.

Last edited by dugan; 07-23-2012 at 08:48 AM. Reason: .bash_profile/.bashrc was a bit confusing
 
Old 07-23-2012, 03:44 AM   #5
Sebi94
Member
 
Registered: Jun 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
Thank you very much! That was it, what I searched!

Now it works all fine.

As system I installed the Live Distributation Knoppix, cause each other distributation couldn't been installed - Why? I don't know. The file /etc/debian_version says "6.0.5".

Thank you for the tipp with the /etc/skel!

Quote:
Originally Posted by /etc/bash.bashrc
# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# General
[ -r /etc/profile ] && . /etc/profile

# bash-specific

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt
PS1='${debian_chroot:+($debian_chroot)}\[\e[0;32m\]\u@\h:\w\$\[\e[00m\] '

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# ;;
#*)
# ;;
#esac

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found ]; then
function command_not_found_handle {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/bin/python /usr/lib/command-not-found -- $1
return $?
else
return 127
fi
}
fi

# KNOPPIX: Activate Control groups for this shell's processes
if [ -d /cgroup/cpu/user ]; then
mkdir -m 0700 /cgroup/cpu/user/$$
echo $$ > /cgroup/cpu/user/$$/tasks
echo -n 1 > /cgroup/cpu/user/$$/notify_on_release
fi >/dev/null 2>&1
Quote:
Originally Posted by /etc/skel/.bash_profile
export PS1='${debian_chroot:+($debian_chroot)}\[\e[0;32m\]\u@\h:\w\$\[\e[00m\] '
 
Old 07-23-2012, 05:11 PM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
Knoppix is meant to be used as a Live CD/DVD and they explain at knoppix.net site below why you will likely have problems using it from a hard drive unless you are a "hard-core experience Linux user":

http://smtp.knoppix.net/wiki/HD_Inst...g_not_to_do_it

Reading the above should give you some insight into potential problems and might help you avoid them?
 
Old 07-24-2012, 03:00 PM   #7
Sebi94
Member
 
Registered: Jun 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
Oh, okay...

Thanks for the link. I will read it as far as possible.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Prompt colors saeedamer Linux - Enterprise 16 03-27-2012 06:53 PM
[SOLVED] How do I permanently change my shell prompt? venom4u31 Linux - Newbie 2 11-16-2011 04:34 PM
changing prompt colors? microsoft/linux Debian 2 05-29-2005 04:22 PM
tcsh prompt with colors TroelsSmit Linux - Newbie 2 12-20-2004 07:55 AM
bash prompt colors emetib Linux - Software 3 06-14-2003 05:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration