LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 04-06-2013, 02:43 AM   #1
Huamin
Member
 
Registered: May 2011
Posts: 355

Rep: Reputation: Disabled
Problem in Terminal


Hi,
Within my Red hat, when I login the server using "oracle" login, and then go to the Terminal, I get the prompt like

bash-3.2$

in that. Why?
 
Old 04-06-2013, 04:02 AM   #2
kooru
Senior Member
 
Registered: Sep 2012
Location: Italy
Distribution: Slackware, NetBSD
Posts: 1,369
Blog Entries: 5

Rep: Reputation: 270Reputation: 270Reputation: 270
What's the problem?
If you don't like the prompt, you can change PS1 variable.

http://www.thegeekstuff.com/2008/09/...ngelina-jolie/
 
Old 04-06-2013, 04:04 AM   #3
Huamin
Member
 
Registered: May 2011
Posts: 355

Original Poster
Rep: Reputation: Disabled
Thanks. I want to see why the prompt does change by itself. And why is the problem only for "oracle" user, while for "root" user, no such problem?

Last edited by Huamin; 04-06-2013 at 04:07 AM.
 
Old 04-06-2013, 10:01 AM   #4
bloody
Member
 
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 158

Rep: Reputation: 23
That's because the shell prompt is configured for each user separately. Don't look at this as a problem, but rather a useful feature. See also: ~/.profile, ~/.bashrc.
 
Old 04-07-2013, 04:25 AM   #5
Huamin
Member
 
Registered: May 2011
Posts: 355

Original Poster
Rep: Reputation: Disabled
Sorry, I am now using "oracle" login and I don't see 2 files below
bash-3.2$ ls ~/.profile
ls: /u01/app/oracle/.profile: No such file or directory
bash-3.2$ ls ~/.bashrc
ls: /u01/app/oracle/.bashrc: No such file or directory
 
Old 04-07-2013, 05:47 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by Huamin View Post
Sorry, I am now using "oracle" login and I don't see 2 files below
bash-3.2$ ls ~/.profile
ls: /u01/app/oracle/.profile: No such file or directory
bash-3.2$ ls ~/.bashrc
ls: /u01/app/oracle/.bashrc: No such file or directory
That's normal. You can create them if you want them.

In answer to the original question, "bash-3.2$" is the default prompt when PS1 is not set.

The link that kooru gave has comprehensive information but does not include setting the window title for terminal emulators. Many of them use xterm's control sequences, assumed below.

In a PS1 value like \[\033]0;\u@\h:\w\007\]\u@\h:\w\$ ...
  1. The \[ ... \] tells bash this part is non-printing and should be discarded when calculating the length of the prompt which the user will see.
  2. The \033 ... \007 tells the terminal to use the contained text as a control sequence.
  3. The ]0; tells the terminal this is its window title.
  4. The \u@\h:\w is the window title -- after changing \u to the user name, \h to the hostname and \w to the working directory in the usual way as well explained in the page linked by kooru.
 
Old 04-07-2013, 06:34 AM   #7
Huamin
Member
 
Registered: May 2011
Posts: 355

Original Poster
Rep: Reputation: Disabled
Thanks a lot. How to set PS1? Why is the problem only for "oracle" login while it is fine for root login?

Last edited by Huamin; 04-07-2013 at 09:33 PM.
 
Old 04-07-2013, 09:33 PM   #8
Huamin
Member
 
Registered: May 2011
Posts: 355

Original Poster
Rep: Reputation: Disabled
Dear all,
Any help to this?
 
Old 04-07-2013, 10:09 PM   #9
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
See post #4; its NOT a problem.
The PS1 prompt (the one you see most of; there are 4 ) can be set individually for each user.
If you want it to be different for the oracle user, here's a couple of links to start with
http://www.cyberciti.biz/tips/howto-...up-prompt.html
http://www.thegeekstuff.com/2008/09/...ngelina-jolie/
 
1 members found this post helpful.
Old 04-07-2013, 10:54 PM   #10
Huamin
Member
 
Registered: May 2011
Posts: 355

Original Poster
Rep: Reputation: Disabled
Thanks. After I've done this
bash-3.2$ PS1="\$"

I see the prompt has been changed to
$
$

but after I've restarted the server, the prompt is still this
bash-3.2$
 
Old 04-08-2013, 02:16 AM   #11
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
Read the links above; they show how to set it permanently.
 
Old 04-08-2013, 02:45 AM   #12
Huamin
Member
 
Registered: May 2011
Posts: 355

Original Poster
Rep: Reputation: Disabled
Hi,
I edited this file
bash-3.2$ cd ~
bash-3.2$ vi .bash_profile

to put this
PS1="\$"

inside it. But after I've restarted the server, I still see this
bash-3.2$

as the prompt.
 
Old 04-08-2013, 04:02 AM   #13
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by Huamin View Post
Why is the problem only for "oracle" login while it is fine for root login?
Because root's shell is initialised differently. Most likely root has one or more of ~/.profile, ~/.bash_profile, ~/.bash_login and ~/.bashrc.
 
Old 04-08-2013, 04:08 AM   #14
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by Huamin View Post
Hi,
I edited this file
bash-3.2$ cd ~
bash-3.2$ vi .bash_profile

to put this
PS1="\$"

inside it. But after I've restarted the server, I still see this
bash-3.2$

as the prompt.
Maybe you are working in an interactive non-logon shell, in which case the PS1 setting needs to be in ~/.bashrc. For most of us the distinction between logon and non-logon shells does not matter. To get the same customisation in both types of shell put this in ~/.bash_profile ...
Code:
case $- in 
 *i* )  # We're interactive 
   if [ -f ~/.bashrc ]; then . ~/.bashrc; fi 
esac
... and this (or your preferred alternayve) in ~/.bashrc
Code:
export PS1='\[\033]0;\u@\h:\w\007\]\u@\h:\w\$ '
There's no need to restart the server to test. You can just use
Code:
source ~/.bashrc
 
1 members found this post helpful.
Old 04-08-2013, 10:20 AM   #15
Huamin
Member
 
Registered: May 2011
Posts: 355

Original Poster
Rep: Reputation: Disabled
Catkin,
It is fine now. Do you think it is due to files accidentally deleted or any other reasons for this problem?

Last edited by Huamin; 04-09-2013 at 02:32 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Terminal problem tayyyar Programming 4 12-09-2010 03:01 PM
problem with terminal sattulinux Linux - Newbie 31 09-18-2010 12:26 AM
Problem with terminal achilies Linux - Software 2 01-03-2010 12:21 PM
Terminal problem Bller Slackware 30 08-22-2009 07:53 PM
qt: terminal problem powadha Slackware 1 12-23-2003 06:17 PM


All times are GMT -5. The time now is 06:00 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration