LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 12-22-2004, 04:14 PM   #1
24jedi
Member
 
Registered: Jul 2003
Location: Richmond, VA
Distribution: LinuxLite
Posts: 77

Rep: Reputation: 15
changing the BASH shell prompt


I noticed on one of our linux servers someone had a custom prompt which basically included the current directory, which sort-of elliminated the need to use the pwd command to see where you were.

I would I change the default prompt in FreeBSD 4.10 for the BASH shell to do this ?
 
Old 12-22-2004, 07:04 PM   #2
-X-
Member
 
Registered: Oct 2003
Location: Tx,USA
Distribution: Slackware, Red Hat, CentOS
Posts: 495

Rep: Reputation: 30
The sh shell doesn't give a path of the current directory without some fancy tricks. I leave root as sh and mine as bash. I think root should be crude to so you won't get in the habit of using it. If you need root much, setup sudo.

To change your shell to bash,,,, as root;
# chsh <user>
Change the shell to /usr/local/bin/bash

You'll be in the vi editor, so knowing some commands wouldn't hurt. You could change the /etc/passwd file. I just don't do it that way.
 
Old 12-23-2004, 07:48 AM   #3
24jedi
Member
 
Registered: Jul 2003
Location: Richmond, VA
Distribution: LinuxLite
Posts: 77

Original Poster
Rep: Reputation: 15
-X-

First...you have posted to several of my questions, thanks.

Two...I was able to change the shell to bash. Took a little reading, but got is going.

Now for S&G (sh*ts-n-giggles), I was interested in knowing how to change the prompt display. This is not pressing. I am working on several other things. I just thought it was pretty cool and conveinent.

Thanks
 
Old 12-23-2004, 09:53 AM   #4
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Code:
export PS1="[\u@\h \W]\\$ "
Get full linux kind of bashy stuff from my script : http://www.cyberciti.biz/nixcraft/pr...ts/enablels.sh

Note it was used on FreeBSD 5.2 but should work on 4.10
 
Old 12-23-2004, 10:16 AM   #5
-X-
Member
 
Registered: Oct 2003
Location: Tx,USA
Distribution: Slackware, Red Hat, CentOS
Posts: 495

Rep: Reputation: 30
nixcraft gave you the standard prompt setting and a pretty good link to other neat stuff.

To find my prompt quickly, mainly when scrolling up through a long output, I have a color prompt. Just a little color to a boring screen. Below is in my /etc/profile. In all user's .bashrc and .bash_profile I have an entry;
source /etc/profile
that picks up the /etc/profile stuff. You can get bash to do lots of things. Have fun!

PS1USER="\[\033[0;36m\]\u@\h\[\033[0m\]\w\[\033[1;33m\]\[\033[0m\]"
case `id -u` in
0) PS1="`whoami`# ";;
*) PS1="${PS1USER}$ ";;
esac
 
Old 12-23-2004, 12:41 PM   #6
Genesee
Member
 
Registered: Dec 2002
Distribution: Slackware
Posts: 927

Rep: Reputation: 30
here's more detail on syntax/color for bash prompts:

http://www-106.ibm.com/developerwork.../l-tip-prompt/
 
Old 12-29-2004, 07:00 PM   #7
rainman4_8
LQ Newbie
 
Registered: Nov 2003
Location: washington
Distribution: still looking
Posts: 16

Rep: Reputation: 0
BASH shell prompt

I have added the appropriate section to my .profile file.

Instead of interpretting the settings (eg. /u = username) the shell displays /u.

Anyone have any ideas?


Oh, and while I'm posting - any good BIND (DNS Server) on BSD resources?

Thanks!!
 
Old 12-29-2004, 08:10 PM   #8
-X-
Member
 
Registered: Oct 2003
Location: Tx,USA
Distribution: Slackware, Red Hat, CentOS
Posts: 495

Rep: Reputation: 30
Look real carefully at your prompt setting. You should see the problem.

Check the Handbook for BIND.
 
Old 12-30-2004, 06:56 AM   #9
Gsee
Member
 
Registered: Mar 2004
Location: Australia
Distribution: FreeBSD, OpenBSD, Gentoo, Debian
Posts: 153

Rep: Reputation: 30
Similar to all this - is there a way to make OpenBSD/FreeBSD to use green text? Thus, black background and green text? I just find it easier to read after many hours of staring at the consoles.

I followed the link given by Genesee and noticed the colour settings - does this enable me to change the colour of the standard text or just the prompt?

Thanks in advance.

Gsee
 
Old 12-30-2004, 12:44 PM   #10
Genesee
Member
 
Registered: Dec 2002
Distribution: Slackware
Posts: 927

Rep: Reputation: 30
do you mean colors in a terminal? if so, for an xterm for example, you can use something like "xterm -bg black -fg green" (for background/foreground)
 
Old 12-30-2004, 06:32 PM   #11
Gsee
Member
 
Registered: Mar 2004
Location: Australia
Distribution: FreeBSD, OpenBSD, Gentoo, Debian
Posts: 153

Rep: Reputation: 30
Sorry, I meant for example on my FreeBSD fileserver which has no X system - is it possible to get colours altered for just the plain non-X console?

gsee
 
Old 01-07-2005, 12:52 AM   #12
Baphomet69
LQ Newbie
 
Registered: Jan 2005
Posts: 1

Rep: Reputation: 0
Yes, please someone explain how to change the actual console text (not just the prompt) color. I've been trying to exactly this same thing and am going nuts trying different things and searching the web.

Help, thanks!
 
Old 03-01-2005, 03:11 AM   #13
Gsee
Member
 
Registered: Mar 2004
Location: Australia
Distribution: FreeBSD, OpenBSD, Gentoo, Debian
Posts: 153

Rep: Reputation: 30
I thought I should let you know that I found this: (Have only tested it with FreeBSD so far).

If I add the line:

allscreens_flags="green black"

to my /etc/rc.conf and reboot - the system will come back up with green text on a black background. Haven't experimented with any other colour options as yet.

Gsee

edit: I just tested this on my OpenBSD box and it doesn't seem to work - Still definitely works with FreeBSD however.

Gsee

Last edited by Gsee; 03-01-2005 at 03:21 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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Bash Prompt socks Slackware 11 02-09-2005 06:32 PM
Changing the BASH Prompt Blade_Powers Linux - Newbie 4 03-28-2004 09:21 PM
changing the way the bash prompt shows up Quartzophobia Linux - General 10 02-15-2004 02:37 PM
Changing the BASH prompt? Dravis Linux - Software 2 01-22-2004 09:17 PM
Changing the command prompt in bash george3k Linux - General 4 07-11-2001 08:10 PM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 10:24 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