LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-15-2017, 03:15 AM   #1
issacnewton
LQ Newbie
 
Registered: Dec 2010
Location: Mumbai, India
Distribution: Debian
Posts: 21

Rep: Reputation: 0
Not able to persist changes to prompt


Hello

I have windows 8.1 as host and inside VirtualBox, I am using CentOS 7.2.1511. Now from windows I use putty to log in to linux once I fire up the virtual machine. Now I want to change the prompt on permanent basis. For that purpose, I need to change .bash_profile file. This works fine from putty. But if I open a terminal inside virtualbox, I can't seem to persist the prompt change with changes to .bash_profile file. I need to make changes to .bashrc file for that to happen. So why terminal inside virtualbox is behaving differently from the putty terminal ?

EDIT: Found a question on stackexchange which seems to answer my question
https://apple.stackexchange.com/ques...ile-and-bashrc

Thanks

Last edited by issacnewton; 08-15-2017 at 03:43 AM.
 
Old 08-15-2017, 05:04 AM   #2
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
If you want to have persistent prompts, as well as other things, like aliases and everything else that you want to customize, no matter if you use login, or no login shell, best idea would be to have 2 files in your home directory, .profile and .bashrc. All customization you do in .bashrc and in .profile you add line to source .bashrc file.
 
Old 08-15-2017, 05:13 AM   #3
issacnewton
LQ Newbie
 
Registered: Dec 2010
Location: Mumbai, India
Distribution: Debian
Posts: 21

Original Poster
Rep: Reputation: 0
Ok, thanks dejank. And how do I add that line ?
 
Old 08-15-2017, 08:14 AM   #4
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
Open .profile file with some text editor that you use, if it does not exist make it. Line you want it:

Code:
source "$HOME/.bashrc"
But, to make it work bit better and just in case:

Code:
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi
For bit of reading about difference between .bashrc, .bash_profile and .profile: https://superuser.com/questions/7894...ile-etc#789465

Last edited by dejank; 08-15-2017 at 08:15 AM.
 
Old 08-15-2017, 08:26 AM   #5
issacnewton
LQ Newbie
 
Registered: Dec 2010
Location: Mumbai, India
Distribution: Debian
Posts: 21

Original Poster
Rep: Reputation: 0
Thanks dejank. Will read that link
 
  


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
route persist issue dara.hr Linux - Networking 2 11-03-2015 05:36 PM
How to make sound persist? lesliek Linux - Newbie 4 01-31-2014 09:53 AM
[SOLVED] Hostname does not persist on LAN int0x80 Linux - General 3 12-07-2011 09:41 AM
My IP is not persist praveenks Linux - Newbie 10 10-16-2009 01:13 AM
How do I persist MTU change? shame Linux - Networking 2 09-27-2006 05:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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