LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-18-2013, 08:59 AM   #1
lmohammeed
Member
 
Registered: Sep 2013
Posts: 38

Rep: Reputation: Disabled
Lightbulb Why my terminal starts with bash-4.2$ on fedora 18?


Dear users
I have got a problem and I need your help.
My terminal starts with bash-4.2$, and I don't know how to restore it back to normal working condition. Please how can I resolve this issue. What should I have done that make the terminal behave in this way? I already visit http://www.linuxquestions.org/questi...me-4175466096/
Your help is highly appreciated.
Regards
Lawal

Last edited by lmohammeed; 11-18-2013 at 09:02 AM. Reason: forgot to add something
 
Old 11-18-2013, 08:00 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,877

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
Quote:
My terminal starts with bash-4.2$
That appears to be a default bash shell prompt for logged in user (root user prompt would be bash-4.3#).
Quote:
I don't know how to restore it back to normal working condition.
What do you consider to be "normal working condition"?

You can set your prompt be editing your ~/.bashrc file. Look for the PS1 prompt line to edit. To find out what the default PS1 prompt is, as it was when you installed Fedora, look at /etc/bash.bashrc or /etc/skel/.bashrc. Copy the PS1 line and past it into your ~/.bashrc.

For more information on shell prompt, read the Bash Prompt HOWTO.
 
1 members found this post helpful.
Old 11-18-2013, 08:39 PM   #3
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by lmohammeed View Post
Dear users
I have got a problem and I need your help.
My terminal starts with bash-4.2$, and I don't know how to restore it back to normal working condition. Please how can I resolve this issue. What should I have done that make the terminal behave in this way? I already visit http://www.linuxquestions.org/questi...me-4175466096/
Your help is highly appreciated.
Regards
Lawal
You probably altered/deleted the .bashrc that shipped with Fedora.

Check in
Code:
/etc/skel/
for .bashrc and .bash_profile and copy them to your home directory.

Code:
lxde@gentoo-asus ~ $ ls -al /etc/skel
total 24
drwxr-xr-x  3 root root 4096 Oct 15 15:55 .
drwxr-xr-x 87 root root 4096 Nov 18 19:21 ..
-rw-r--r--  1 root root  127 Oct 15 15:55 .bash_logout
-rw-r--r--  1 root root  193 Oct 15 15:55 .bash_profile
-rw-r--r--  1 root root  551 Oct 15 15:55 .bashrc
drwx------  2 root root 4096 Dec  8  2011 .ssh
 
1 members found this post helpful.
Old 11-18-2013, 11:28 PM   #4
lmohammeed
Member
 
Registered: Sep 2013
Posts: 38

Original Poster
Rep: Reputation: Disabled
Lightbulb Why my terminal starts with bash-4.2$ on fedora 18?

Dear bigrigdriver and andrewthomas,
Thank you for your email.
Quote:
What do you consider to be "normal working condition"?
problem free terminal.
I try to edit /.bashrc using
Code:
vi
but, I got empty "/.bashrc" [New File].
When I run
Code:
cd /etc/skel/
as root user I got
Code:
[root@localhost skel]
, nothing more.
So, now what should I do? Please don't forget I am inexperience.
Waiting for your help.
With kind regards
Lawal
 
Old 11-19-2013, 12:04 AM   #5
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 516

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by lmohammeed View Post
I try to edit /.bashrc using
Code:
vi
but, I got empty "/.bashrc" [New File].
That's because you are creating new file in root. Try

Code:
vi ~/.bashrc
If its empty, put following lines in
PHP Code:
if [ -/etc/bashrc ]; then
    
. /etc/bashrc
fi 
Also are sure you have not deleted your home directory?

Code:
cd ~
pwd
 
1 members found this post helpful.
Old 11-19-2013, 05:01 AM   #6
lmohammeed
Member
 
Registered: Sep 2013
Posts: 38

Original Poster
Rep: Reputation: Disabled
Why my terminal starts with bash-4.2$ on fedora 18?

Dear mddesai,
Thank you for your email.
I try
Code:
vi ~/.bashrc
this only work from root. I got this
Quote:
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

. /opt/intel/bin/compilervars.sh intel64

#------------------------------------------------------------------------
# this is for XCRYSDEN 1.5.21; added by XCRYSDEN installation on
# Tue Apr 17 18:12:32 MYT 2012
#------------------------------------------------------------------------
XCRYSDEN_TOPDIR=/home/mohammed/WIEN2K/XCrySDen-1.5.21-bin-semishared
XCRYSDEN_SCRATCH=/home/mohammed/xcrys_tmp
export XCRYSDEN_TOPDIR XCRYSDEN_SCRATCH
PATH="$XCRYSDEN_TOPDIR:$PATH:$XCRYSDEN_TOPDIR/scripts:$XCRYSDEN_TOPDIR/util"

~
~
~
~
~
~
~
"~/.bashrc" 16L, 591C
What should I do next?
Waiting for respose.
 
Old 11-19-2013, 07:32 AM   #7
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 516

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by lmohammeed View Post
I try
Code:
vi ~/.bashrc
this only work from root.
This means you have deleted your home directory. As a regular user show your username and /home folder

Code:
$ who am i
$ ls -l /home
 
1 members found this post helpful.
Old 11-19-2013, 08:59 AM   #8
lmohammeed
Member
 
Registered: Sep 2013
Posts: 38

Original Poster
Rep: Reputation: Disabled
Lightbulb Why my terminal starts with bash-4.2$ on fedora 18?

Thank you mddesai,
The result of the two command
Code:
bash-4.2$ who am i
mohammed pts/0        2012-01-19 17:08 (:0)
bash-4.2$ ls -1 /home
mohammed
bash-4.2$
Thanks once again in anticipating your responce.
Lawal
 
Old 11-19-2013, 09:24 AM   #9
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 516

Rep: Reputation: 139Reputation: 139
hmmm strange. There is home directory for user 'mohammed', but why you said "vi ~/.bashrc only works from root". besides its not 1(one), but its l(L) in ls -l /home. probably ownership is set wrong. Anyway try again ls -l /home

it show something like this
Code:
drwx------. 64 mohammed mohammed 4096 Nov 19 19:27 /home/mohammed

Last edited by mddnix; 11-19-2013 at 09:25 AM.
 
1 members found this post helpful.
Old 11-19-2013, 10:21 AM   #10
lmohammeed
Member
 
Registered: Sep 2013
Posts: 38

Original Poster
Rep: Reputation: Disabled
Lightbulb Why my terminal starts with bash-4.2$ on fedora 18?

Thank you mddesai,
Yes, if not from root "vi ~/.bashrc" give "~/.bashrc" [New File]
Sorry for the above mistake.
Code:
bash-4.2$ ls -l /home
total 0
drwx------. 1 mohammed mohammed 1106 Jan 19 18:37 mohammed
bash-4.2$
Thank you so much.
Lawal
 
Old 11-19-2013, 10:57 AM   #11
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 516

Rep: Reputation: 139Reputation: 139
Let me clarify what you are saying...

as root you can open .bashrc, however, as user the .bashrc is NEW file...

In that case, do following...

Code:
su - mohammed
cd /home/mohammed
vi .bashrc
a new empty file will open..

type following:
PHP Code:
if [ -/etc/bashrc ]; then
    
. /etc/bashrc
fi 
then source .bashrc file
Code:
. /home/mohammed/.bashrc
You should get normal prompt.

Note: I assume you know how to enter text in vi editor.

Last edited by mddnix; 11-19-2013 at 10:59 AM.
 
Old 11-19-2013, 11:46 AM   #12
lmohammeed
Member
 
Registered: Sep 2013
Posts: 38

Original Poster
Rep: Reputation: Disabled
Lightbulb Why my terminal starts with bash-4.2$ on fedora 18?

Thank you mddesai,
Quote:
as root you can open .bashrc, however, as user the .bashrc is NEW file...
yes.
I run the codes as you said, typed
PHP Code:
if [ -/etc/bashrc ]; then
                                            
. /etc/bashrc 

                                        fi 
and source .bashrc file in the same terminal. Save and exit using
Code:
:wq!
However, instead of getting normal prompt I got empty prompt. I restart the system, now after several attempt the system would starts and then quickly asked for password again. I have use another computer to reply you.
Thanks once more
Lawal
 
Old 11-20-2013, 02:58 AM   #13
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 516

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by lmohammeed View Post
and source .bashrc file in the same terminal. Save and exit using
Code:
:wq!
You should save the file first and then source it.

Quote:
Originally Posted by lmohammeed View Post
However, instead of getting normal prompt I got empty prompt. I restart the system, now after several attempt the system would starts and then quickly asked for password again. I have use another computer to reply you.
Very strange. The only guess i can do now is that you have seriously messed-up something else. Running /etc/bashrc shouldn't be that dangerous .

Either replace your /etc/bashrc from the here (post #2) http://fedoraforum.org/forum/showthread.php?t=104297

Or, add following lines to your /home/mohammed/.bashrc file

Code:
export PS1="[\u@\h \W]\$"
export PS2=">"
 
1 members found this post helpful.
Old 11-20-2013, 04:04 AM   #14
lmohammeed
Member
 
Registered: Sep 2013
Posts: 38

Original Poster
Rep: Reputation: Disabled
Lightbulb Why my terminal starts with bash-4.2$ on fedora 18?

Thanks you so much mddesai,
Quote:
You should save the file first and then source it.
That really make me a Newbie.
If I get you right, after saving, then I should open the file again using vi editor and then source. Please confirm if I am right, just in case it happens again.
Quote:
Very strange. The only guess i can do now is that you have seriously messed-up something else. Running /etc/bashrc shouldn't be that dangerous .

Either replace your /etc/bashrc from the here (post #2) http://fedoraforum.org/forum/showthread.php?t=104297

Or, add following lines to your /home/mohammed/.bashrc file
I can't remember doing anything unreasonable. Right now my present situation is I got a black screen, with the first line reading
Quote:
[ 1.007510] Problem loading in-kernel X.509 certificate (-129)
and a blinking cursor. If by chance ('cos 'm helpless) the screen comes back I will try your suggestions.
Thanks
Lawal
 
Old 11-20-2013, 05:47 AM   #15
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 516

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by lmohammeed View Post
If I get you right, after saving, then I should open the file again using vi editor and then source. Please confirm if I am right, just in case it happens again.
No... You got it wrong. Sourcing a script is similar to executing a script on shell. The only difference is that executing a script (with ./ or sh) will execute it in sub-shell, where as sourcing (with . or source) a script will execute it in current shell. So whatever changes you make in .bashrc, and when you source it, the contents of script are executed and are available to you on the same shell you are working on.

To put in simple words...
  1. open vi editor (~/.bashrc)
  2. enter the contents (post #11)
  3. save the file (:wq) (dont open .bashrc again)
  4. And in command prompt just type the following and press <enter>
Code:
$ . ~/.bashrc
Note: Or you can type the following... both are same
Code:
$ source ~/.bashrc
More: What is sourcing a file?

Last edited by mddnix; 11-20-2013 at 06:03 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
[SOLVED] Script to run when terminal starts? dilzniksan Linux - General 1 06-02-2010 12:54 PM
PCLinuxOS starts in terminal Mark1986 Linux - Newbie 3 08-03-2008 01:34 PM
pressing 'x' in gnome terminal starts new terminal instance Drwfan54 Ubuntu 3 09-26-2006 04:09 PM
emelfm2 starts from terminal, not otherwise dhave Linux - Software 1 12-30-2005 09:58 AM
telnet auto starts on terminal b0m8ad1l Linux - Newbie 0 02-16-2004 12:05 AM


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