LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   root login directly into -bash-3.2# (https://www.linuxquestions.org/questions/linux-newbie-8/root-login-directly-into-bash-3-2-a-797101/)

prasadshetty 03-22-2010 02:06 PM

root login directly into -bash-3.2#
 
Hi all,
i am using fedora 10
while i login as a normal user its working fine username@hostname
while i login as a root user it goes directly into -bash-3.2#
if i check pwd it shows /root
till now i am not facing any problem as i am using as a normal user
but how can i change -bash-3.2# to root@hostname
which file and where to edit

mario.almeida 03-22-2010 02:41 PM

Hi,

what is the output of echo $PS1

you can also type bash and enter

repo 03-22-2010 02:44 PM

You can create a .bashrc file in your root directory
containing
Code:

PS1="\[\u@\h:\W]# \[\e[0m\]"

onebuck 03-22-2010 04:05 PM

Hi,

You could setup a .bashrc & .bash_profile for your user;

Code:

sample .bash_profile;

~$ cat .bash_profile
# .bash_profile
#08-30-06 12:21
#
# Source .bashrc
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

Code:

sample .bashrc;
:~$ cat .bashrc

#.bashrc
#08-30-06 12:20

# Add bin to path

export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"

#export PATH="$PATH:$HOME/bin"

# Dynamic resizing
shopt -s checkwinsize

# Custom prompt
#PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

#08-29-06 11:40

if [ `id -un` = root ]; then
  PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '
 else
  PS1='\[\033[1;32m\]\h:\w\$\[\033[0m\] '
fi

#
# Add color
eval `dircolors -b`

# User defined aliases
alias cls='clear'
alias clls='clear; ls'
alias ll='ls -l'
alias lsa='ls -A'
alias lsg='ls | grep'
alias lsp='ls -1 /var/log/packages/ > package-list'
alias na='nano'
alias web='links -g -download-dir ~/ www.google.com'

#08-29-06 11:50

#To clean up and cover your tracks once you log off
#Depending on your version of BASH, you might have to use
# the other form of this command
  trap "rm -f ~$LOGNAME/.bash_history" 0

#The older KSH-style form
#  trap 0 rm -f ~$LOGNAME/.bash_history

The .bashrc is very useful! I like to use the .bash_profile to test then use the .bashrc.

prasadshetty 03-24-2010 03:03 PM

Quote:

Originally Posted by mario.almeida (Post 3907883)
Hi,

what is the output of echo $PS1

you can also type bash and enter

[prasad@localhost ~]$ echo $PS1
[\u@\h \W]\$

Aquarius_Girl 07-28-2010 04:36 AM

Quote:

Originally Posted by prasadshetty (Post 3907846)
but how can i change -bash-3.2# to root@hostname
which file and where to edit

Read the following links:
http://www.linuxselfhelp.com/howtos/...t-HOWTO-2.html

http://tldp.org/HOWTO/Bash-Prompt-HOWTO/

Did you bother to read the Post number 3 and 4 ????
Did you bother to thank the above people who have tried to help you ????

sem007 07-28-2010 04:51 AM

copy files from skel to /root.

Code:

cp /etc/skel/.* /root
HTH


All times are GMT -5. The time now is 10:59 PM.