Changing the environment variable permanently in Ubuntu 10.10
Friends, I want to make change to environment PATH system wide. Because I have program called "md5". I want to execute it from anywhere (i.e any directory).
My md5 program is located at "/home/ahuq/MappingServer/md5_program". So what I did was to put: "export PATH=$PATH:/home/ahuq/MappingServer/md5_program" in the running SHELL. This only makes temporary changes and lets me run the "md5" program from anywhere temporarily. But I want to make this change permanent. So what I did was to put the "PATH=$PATH:/home/ahuq/MappingServer/md5_program" line into the "/etc/environment" file. This screwed everything up and then for a while I couldn't execute anything from SHELL. I knew the absolute path of "nano" editor and used it to modify the file (i.e. /etc/environment) back to its original condition. This fixed the problem and now I can run programs like "ls" from the SHELL. But still I need a way to permanently add the path of "md5" to the environment. How can I do this in Ubuntu 10.10? Which file needs to edited? Do I just logout or do I have to restart the system to make the changes active? Bye. |
Quote:
What I get is that you want all users to be able to access this program, and all I can think of is: Have you done a $ chmodcommand? ch allows whoever you add to it, permission to access files for their own use or reading ... I don't know if that applies to you, But it sounds like it may. From washington.edu: To change the mode of a file, use the chmod command. The general form is Code:
chmod X@Y file1 file2 Y is any combination of `r', `w', `x'. Following are some examples: Code:
Quote:
1) If it causes the system to malfunction or run undesirably, I know what the reason is. 2) From what I understand, Linux holds onto processes as long as it is using them, So I like to restart and have it be as fresh as possible before running new things, or working with changes I have made. Hope this info is helpful, and if not ... Well I tried :p Best of luck! |
You need to add that PATH statement to your .bashrc file (/home/ahuq/.bashrc).
Let me know if you need more help, and don't forget to click the little "yes" button if this helped you. |
Quote:
|
@spankbot......... I put in the line "PATH=¤$PATH:/home/ahuq/MappingServer/md5_program" at the end of the "/home/ahuq/.bashrc" file. Then logged out of the SHELL and went in again. It did not work:
root@ahuq-kitchen:/home/ahuq# md5 -sanis No command 'md5' found, did you mean: Command 'cd5' from package 'cd5' (universe) Command 'mdu' from package 'mtools' (main) Command 'mdb' from package 'mono-debugger' (universe) md5: command not found But when I did "export PATH=$PATH:/home/ahuq/MappingServer/md5_program" on the SHELL, the program "md5" became available temporarily. root@ahuq-kitchen:/home/ahuq# md5 -sanis MD5 ("anis") = 38a1ffb5ccad9612d3d28d99488ca94b @thund3rstruck.... the same thing happened when I put "PATH=$PATH:/home/ahuq/MappingServer/md5_program" at the end of the .profile file. I couldn't run "md5". Maybe I am putting the PATH statement in the wrong place of the above mentioned files. There are a lot if-else-fi structures inside those two files. Do I need to put the PATH statement inside any of those structures? |
Quote:
The "$PATH" variable defines the directories the shell should search to find executable files. For example see the ~/.bash_profile script below: Code:
# .bash_profile Code:
$ Re[tab] Code:
PATH=$PATH:$HOME/MappingServer/md5_program Regards, |
@anis. Sorry, I assumed you knew you needed to include the export command in your .bashrc or .bash_profile file. You can do it all in one step too...
export PATH=$PATH:/home/ahuq/... |
All times are GMT -5. The time now is 04:09 AM. |