View Full Version : [ubuntu] .bashrc file editing
FailureToLoad
April 15th, 2009, 05:45 PM
I'm very new to this operating system so I apologize if this is an obvious topic. I've googled around and can't really find many answers to this problem.
Recently these forums have helped me install Ubuntu and get jgrasp up and running within it. Unfortunately, some PATH confusion has made it so the debugger does not run at all.
I found this fix on the problem
In summary, how to get the debugger working with JDK 1.6 installed through Synaptic:
Add /usr/lib/jvm/java-6-sun/bin to your $PATH directory. Do this by putting the following two lines in your ~/.bashrc file.
PATH=/usr/lib/jvm/java-6-sun/bin:$PATH
export PATH
Logout, log back in, and voila! You have a debugger in Jgrasp!
Seems straightforward but I'm unclear as to where the file I need to be editing is located. Is the bash.bashrc what I should be toying with or is there another being referenced?
Slim Odds
April 15th, 2009, 05:48 PM
~ refers to your home directory
so just edit ~/.bashrc
If you want to make it global (for all users) put it in /etc/bash.bashrc
FailureToLoad
April 15th, 2009, 05:51 PM
~ refers to your home directory
so just edit ~/.bashrc
If you want to make it global (for all users) put it in /etc/bash.bashrc
Now, is this done through the root terminal or is there a hidden .bashrc file within my home directory?
James_Lochhead
April 15th, 2009, 05:55 PM
bash.bashrc is a different file to what the one in the tutorial.
~ in the terminal equates to the absolute path of your home directory (e.g. /home/james for me). So the file is /home/<your_username>/.bashrc.
. in front of a file means it is hidden. To unhide it in Nautilus (Ubuntu file manager) press ctrl h. If you use Dolphin (Kubuntu file manager) press alt full stop.
By the way you can add it to the bash.bashrc file if you want. This will install the PATH for every user (~/.bashrc is just for you).
If you want to read up a little on this you can read the section on installing the PATH variable in my JDK tutorial (see the left side of my sig). You can ignore the specifics about the JDK; there is an explanation about each of the 4 possible files where you could put the PATH (in Ubuntu - there are more than 4 possible files in Linux as a whole - some are not used in Ubuntu).
Copernicus1234
April 15th, 2009, 05:55 PM
Its in your home directory so you own it and dont need root access to modify it.
All files starting with a dot (.) are hidden. List them with ls -al. :)
Slim Odds
April 15th, 2009, 05:56 PM
Now, is this done through the root terminal or is there a hidden .bashrc file within my home directory?
Filenames starting with a . are normally hidden by both the bash ls command and nautilus.
If you need to see it (which you don't to edit it) try:
ls -a
To edit your local .bashrc, just open a terminal window and edit it. For the /etc/ one, you'll need to sudo.
Alekz_
April 15th, 2009, 06:02 PM
Hey! I think that it would be better if you export the PATH var in the /etc/profile
Doing this, any user will have the the full PATH var loaded!
[]'s
Alekz_
James_Lochhead
April 15th, 2009, 06:09 PM
Hey! I think that it would be better if you export the PATH var in the /etc/profile
Doing this, any user will have the the full PATH var loaded!
[]'s
Alekz_
/etc/bash.bashrc (the file he originally referred to) will do this as well.
/etc/profile is loaded once on login for every user
/etc/bash.bashrc is loaded every time every user opens a terminal
~/.bashrc is loaded every time a single user opens a terminal
~/.profile is loaded once when a single user logs on
FailureToLoad
April 15th, 2009, 06:12 PM
Filenames starting with a . are normally hidden by both the bash ls command and nautilus.
If you need to see it (which you don't to edit it) try:
ls -a
To edit your local .bashrc, just open a terminal window and edit it. For the /etc/ one, you'll need to sudo.
See, this confuses me. I'm comming fresh from windows so I really apologize for being so dense, but if I don't need to see the file to edit it, how am I editing it? When you say "terminal", what exactly are you referring to because for me, this means the root terminal.
Hey! I think that it would be better if you export the PATH var in the /etc/profile
Doing this, any user will have the the full PATH var loaded!
[]'s
Alekz_
Fair enough, how would I go about that? Slim says a sudo command is needed.
Alekz_
April 15th, 2009, 06:19 PM
Ow! Sorry! I'll try to be as clear as I can! :)
Easy way to edit the file:
Hit ALT + F2 (it'll open a small window, similar with the Run dialog on MS Windows)
Now, you type:
gksu gedit /etc/profile (it will ask for your password)
Now that you have GEDIT opened (its a simple text editor), you can put these lines at the end of the file:
PATH=/usr/lib/jvm/java-6-sun/bin:$PATH
export PATH
IF there is already a PATH=some_text:$PATH then you just need to add the /usr/lib/jvm/java-6-sun/bin path!
[]'s
Alekz_
FailureToLoad
April 15th, 2009, 06:22 PM
Ow! Sorry! I'll try to be as clear as I can! :)
Easy way to edit the file:
Hit ALT + F2 (it'll open a small window, similar with the Run dialog on MS Windows)
Now, you type:
gksu gedit /etc/profile (it will ask for your password)
Now that you have GEDIT opened (its a simple text editor), you can put these lines at the end of the file:
PATH=/usr/lib/jvm/java-6-sun/bin:$PATH
export PATH
IF there is already a PATH=some_text:$PATH then you just need to add the /usr/lib/jvm/java-6-sun/bin path!
[]'s
Alekz_
So if I understand you right, you want me to open the bash.bashrc file using gedit and simple copy and paste that command at the end of the file?
Alekz_
April 15th, 2009, 06:31 PM
So if I understand you right, you want me to open the bash.bashrc file using gedit and simple copy and paste that command at the end of the file?
NO! Not the bash.bashrc file...
I'm suggenting you to use the profile file!
As I said:
/etc/profile
And YES! That's just copy and past the PATH at the end of the file! :)
FailureToLoad
April 15th, 2009, 06:32 PM
NO! Not the bash.bashrc file...
I'm suggenting you to use the profile file!
As I said:
/etc/profile
And YES! That's just copy and past the PATH at the end of the file! :)
Haha well see thats the issue, opening the profile file just opens a blank file.
FailureToLoad
April 15th, 2009, 07:08 PM
Going into the /ect folder I'm able to do find the profile file you're talking about, open it and see that it does have content to it, but going straight through the run-time panel as you suggested originally sends me to a blank file.
Alekz_
April 15th, 2009, 07:27 PM
Well.. Are you typing like this:
gksu gedit /etc/profile
?????
If you don't put the full path it does't work! :)
FailureToLoad
April 15th, 2009, 07:32 PM
Well.. Are you typing like this:
gksu gedit /etc/profile
?????
If you don't put the full path it does't work! :)
haha yes I did. What finally got it is there was an option to run the command with a selected file so I did gksu gedit and then selected the profile from a file list. Unfortunatley, my debugger still does not work... So back to google to find something else.
Thank you very much for bearing with me, I know it can be frustrating to get your point across to someone of lesser knowledge on a topic.
Alekz_
April 15th, 2009, 07:37 PM
Ow! No problem! Just a tip... The profile file is "loaded" when you start a session and/or when you open a new terminal! So, I suggest you to restart your session and try again...
You also can run from terminal:
. /etc/profile
:)
name123
April 18th, 2009, 12:58 PM
My problem is that the terminal is unable after I open an editor window. I can't run others commands until I close the editor. I use nedit editor and I already edit this file with alias for nedit.
Do I have to edit the .bashrc file to solve this problem?
Slim Odds
April 18th, 2009, 06:31 PM
My problem is that the terminal is unable after I open an editor window. I can't run others commands until I close the editor. I use nedit editor and I already edit this file with alias for nedit.
Do I have to edit the .bashrc file to solve this problem?
Open 2 terminals? or 3 or 12
leandromartinez98
April 18th, 2009, 06:40 PM
I woudn't suggest for these guys to modify the /etc/profile or bash.bashrc files as root given the lack of experience they have, doing something wrong there can damage many things.
I suggest, first, backup your .bashrc file:
cp ~/.bashrc ~/.bashrc.backup
Then, add those lines to the end of the .bashrc file:
gedit ~/.bashrc
Save, and quit. If some other user uses your machine, do the same to the
.bashrc located is his/her home folder, until you get used enough to linux to
be sure of what you are doing in system-wide configurations.
If something goes wrong, take it back with:
cp ~/.bashrc.backup ~/.bashrc
abhiroopb
January 23rd, 2010, 05:22 AM
This is "kind of" related.
I have my bashrc file set up in the following manner:
#.bashrc
#function prompt
#{
#local WHITE="\[\033[1;37m\]"
#local GREEN="\[\033[0;32m\]"
#local CYAN="\[\033[0;36m\]"
#local GRAY="\[\033[0;37m\]"
#local BLUE="\[\033[0;34m\]"
#local RED="\[\033[0;31m\]"
#local YELLOW="\[\033[1;33m\]"
#export PS1="
#${WHITE}[\t]
#${YELLOW}$PWD
#${GREEN}$ "
#}
#prompt
PS1='
\[\033[1;37m\][\t]
\e[1;33m$(pwd) \e[1;32m\n\$ '
alias ll="ls -l"
alias la="ls -A"
alias l="ls -CF"
alias bashrc="gedit ~/.bashrc &"
alias starwars="telnet towel.blinkenlights.nl"
alias ipaddress="ifconfig -a"
alias grub="gksudo gedit /etc/default/grub &"
alias removeorphan="sudo deborphan | xargs sudo apt-get -y remove --purge"
alias sources="gksudo gedit /etc/apt/sources.list"
alias clean="sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean && sudo apt-get purge && sudo deborphan | xargs sudo apt-get -y remove --purge"
alias Backup="sudo /home/abhiroop/Computers/Bash/Backup/Backup.sh"
alias BackupUSB="/home/abhiroop/Computers/Bash/Backup/BackupUSB.sh"
alias BackupHD="/home/abhiroop/Computers/Bash/Backup/BackupHD.sh"
alias ConfigFiles="/home/abhiroop/Computers/Bash/ConfigBackup/ConfigFiles.sh"
alias pubkey="sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com"
alias tedtalks="/home/abhiroop/Computers/Bash/tedtalks.sh"
alias netstart="sudo /etc/init.d/NetworkManager start"
alias netstop="sudo /etc/init.d/NetworkManager stop"
alias netrestart="sudo /etc/init.d/NetworkManager restart"
alias multimonitor="sudo cp /home/abhiroop/Computers/Bash/xorg.conf.multi /etc/X11/xorg.conf"
alias singlemonitor="sudo cp /home/abhiroop/Computers/Bash/xorg.conf.single /etc/X11/xorg.conf"
alias update="sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean && sudo apt-get purge && sudo deborphan | xargs sudo apt-get -y remove --purge"
alias install="sudo apt-get install"
alias search="sudo apt-cache search"
alias remove="sudo apt-get purge"
alias startssh="sudo /etc/init.d/ssh start"
alias stopssh="sudo /etc/init.d/ssh stop"
alias speakertest="speaker-test -Dplug:surround40 -c4 -l1 -twav"
alias chrome="gedit /home/abhiroop/Computers/Bash/google-chrome.sh"
Basically, when I open a terminal things appear as you would expect (see screenshot terminal-bashrc.png) with the specially configured bashrc file.
However, when I right click on a folder in nautilus and select "open in terminal" I get the standard gnome-terminal without any of my pre-configured basrhc settings (terminal-normal.png)
Do I need to configure this terminal separately?
I noticed that there are mentions of /etc/profile and all that, is this somehow connected?
Also this only happened since upgrading to karmic before I did not have this problem.
Any thoughts?
Powered by vBulletin® Version 4.2.2 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.