LinuxQuestions.org
Visit Jeremy's Blog.
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 03-17-2010, 06:55 AM   #1
NoahJK
LQ Newbie
 
Registered: Mar 2010
Posts: 26

Rep: Reputation: 0
root@hostname


Hello,

I installed slackware 13 and in KDE it works fine but after I changed to xfce4 when I open a terminal I see only:
bash3.1 #
instead of
root@hostname #

How could I change bash3.1 to look like root@hostname when I open a terminal

I have done it via .bashrc on my old distribution but slackware doesn't have .bashrc as far as I know.

Thanks
 
Old 03-17-2010, 07:04 AM   #2
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
You can simply create a .bashrc in your home folder and change the command prompt. Each new bash process will then use the new prompt (PS1). .bashrc is a bash configuration file and has nothing to do whether you use Slackware or whatever distribution, unless Slackware uses a modified version of bash that disables .bashrc. In this case just download the bash source code and compile it on your own.
 
Old 03-17-2010, 07:20 AM   #3
NoahJK
LQ Newbie
 
Registered: Mar 2010
Posts: 26

Original Poster
Rep: Reputation: 0
Could someone please give me your .bashrc then to I can use it?

thanks
 
Old 03-17-2010, 07:21 AM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
I have this in my .bashrc for root
Code:
PS1="\[\u@\h \W]# \[\e[0m\]"
 
Old 03-17-2010, 07:35 AM   #5
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Mine contains:
Code:
PS1='\u@\h:\w> '
 
Old 03-17-2010, 08:35 AM   #6
NoahJK
LQ Newbie
 
Registered: Mar 2010
Posts: 26

Original Poster
Rep: Reputation: 0
Does it have only PS1 or there is anything else in it? I would need a FULL .bashrc, if possible.

Thanks guys
 
Old 03-17-2010, 08:48 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by NoahJK View Post
Does it have only PS1 or there is anything else in it? I would need a FULL .bashrc, if possible.
.bashrc is for customising your bash environment to personal taste so what's in it depends on -- what you want!

For example, all I have is PS1 and some aliases. PS1 you already know about; here are the only aliases that might be any use to anyone else
Code:
alias lrt='ls -lrt --human-readable --color=never'
alias ll='ls -l --human-readable --color=never'
 
Old 03-18-2010, 06:13 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
As above, it's entirely up to you what you want to put in your .bashrc. Mine has
Code:
# .bashrc

# User specific aliases and functions


# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
which is the installation default.
 
Old 03-18-2010, 10:21 AM   #9
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
My .bashrc:

Code:
# michael's .bashrc

# Check for an interactive session
[ -z "$PS1" ] && return

alias ls='ls --color=auto'

# Aliases to change keyboard layout in X

alias dvorak='setxkbmap -layout dvorak'
alias ekrpat='setxkbmap -layout us' # 'ekrpat' is 'dvorak' typed on a qwerty keyboard remapped to Dvorak

PS1='\[\e[1;32m\][\u:\W]\$ \[\e[m\]'
PS2='\[\e[1;32m\]> \[\e[m\]'
PS3='\[\e[1;32m\]#? \[\e[m\]'
PS4='\[\e[1;32m\]$0:$LINENO+ \[\e[m\]'

# Display notes

if [ -f ~/notes.txt ]; then
        echo ""
        echo '----- NOTES -----'
        echo ""
        cat ~/notes.txt
        echo ""
else
        echo '"~/notes.txt" does not exist or is not a normal file!'
        echo ""
fi
And as others said, you can put ANYTHING you want in it. It's just a plain bash script that bash automatically runs when bash starts.

Last edited by MTK358; 03-18-2010 at 10:24 AM.
 
  


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
Changed hostname during install, now CUPS has wrong hostname on web interface slinx Linux - Software 1 08-07-2009 08:01 PM
after hostname change, syslogd still output previous hostname to messages file tiger2000 Linux - General 3 07-22-2009 09:36 PM
Define new hostname without root access? pwc101 Linux - Networking 8 07-31-2008 05:05 AM
Sendmail on RHEL - mailing as root; want root@hostname.domain davee Linux - Software 2 07-13-2007 03:30 AM
hostname and root folder charnel Programming 1 07-24-2005 01:54 PM

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

All times are GMT -5. The time now is 12:14 PM.

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