Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 17th, 2011, 04:30 PM
beebac beebac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2011
Posts: 107 beebac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 8 m 18 sec
Reputation Power: 3
Set up linux environment variable or path?

Hi. I'm a window user and trying linux - ubuntu now.

I wonder how you set up your environment variable or path in linux?

I know how to do that in window but not sure how you do it in linux. I don't think it has like an interface to add it easily like in window?

Reply With Quote
  #2  
Old December 18th, 2011, 07:02 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 41 m
Reputation Power: 1485
Just how and where you do this will depend upon two things, the shell the user will be using and if you wish to alter the setting/value globally or individually.
As you are using Linux I'd guess you shell may well be bash - so for individuals you could edit the .bash_profile file in the home directory of the relevant user, but you may prefer to use a .profile instead as that will also be used by bourne/korn shells (ig .bash_profile does not exist).
For global changes (that affect all users) look at the /etc/profile which will be used by all bourne-type shells.
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc

Reply With Quote
  #3  
Old December 18th, 2011, 03:34 PM
beebac beebac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2011
Posts: 107 beebac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 8 m 18 sec
Reputation Power: 3
Quote:
Originally Posted by SimonJM
Just how and where you do this will depend upon two things, the shell the user will be using and if you wish to alter the setting/value globally or individually.
As you are using Linux I'd guess you shell may well be bash - so for individuals you could edit the .bash_profile file in the home directory of the relevant user, but you may prefer to use a .profile instead as that will also be used by bourne/korn shells (ig .bash_profile does not exist).
For global changes (that affect all users) look at the /etc/profile which will be used by all bourne-type shells.


Hi. I can't get it to work and I don't know why.

I add this line on /home/bee/.bash_profile

export PATH=$PATH:/opt/lampp

Then I logout and log in as bee again.

Then I echo $PATH and I don't see my added path.

bee@bee-EG134AA-ABA-a1230n:~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Any idea what I did wrong? Thanks.

Reply With Quote
  #4  
Old December 18th, 2011, 04:28 PM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 41 m
Reputation Power: 1485
Are you running the bash shell?
Try echo $SHELL

Reply With Quote
  #5  
Old December 20th, 2011, 11:14 AM
beebac beebac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2011
Posts: 107 beebac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 8 m 18 sec
Reputation Power: 3
Quote:
Originally Posted by SimonJM
Are you running the bash shell?
Try echo $SHELL


Hi. I just did this. I installed ubuntu 11.10 recently. I'm still confuse why it's not working. Any idea?

bee@bee-EG134AA-ABA-a1230n:~$ echo $SHELL
/bin/bash

Reply With Quote
  #6  
Old December 20th, 2011, 11:17 AM
beebac beebac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2011
Posts: 107 beebac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 8 m 18 sec
Reputation Power: 3
Quote:
Originally Posted by SimonJM
Are you running the bash shell?
Try echo $SHELL


There's also a .profile too but it seems it will ignore it base on it's comment where .bash_profile exists.

Any idea? Thanks.

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

Reply With Quote
  #7  
Old December 20th, 2011, 11:33 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 41 m
Reputation Power: 1485
I have to admit on my little netbook I just have a .profile with my bash shell user ... Migrate the PATH stuff across to .profile, get rid of the .bash_profile and see what happens?
Also, don't logout and back in again, you can just source the file to get it to be re-read:
Code:
. .profile

Note, that is dot space at the start

Reply With Quote
  #8  
Old December 20th, 2011, 03:58 PM
beebac beebac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2011
Posts: 107 beebac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 8 m 18 sec
Reputation Power: 3
Quote:
Originally Posted by SimonJM
I have to admit on my little netbook I just have a .profile with my bash shell user ... Migrate the PATH stuff across to .profile, get rid of the .bash_profile and see what happens?
Also, don't logout and back in again, you can just source the file to get it to be re-read:
Code:
. .profile

Note, that is dot space at the start


Hey thanks. I can get it to work on .profile and when I do echo it has the new path now.

I also tried to put it on /etc/profile and when I logout and login as bee then the new path is there too.

But when I su as root and echo $PATH then it doesn't have the new path. Any idea why?

Reply With Quote
  #9  
Old December 21st, 2011, 05:39 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 41 m
Reputation Power: 1485
Not off the top of my head - I'd check the shell root uses and also what 'start-up' files (such as .profile) the root user has as that could over-write any prior changes done in the generic /etc/profile.
I would add a word of caution here as to what you put in the PATH for the root user: it is best not to place the current directory (the . character) in the PATH. Also add new paths at the ned, keeping the 'system' paths at the beginning.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Set up linux environment variable or path?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap