I'm trying to update my bashrc file in ubuntu with some environment variables.
I can do this using below command.
echo 'export APP=/opt/tinyos-2.x/apps' >> ~/.bashrc
But I want to do it manually, meaning open the file with vim editor then add it. The problem here is when I open the bashrc file the end line is "fi" and when I reach there and press insert and then enter to go to new line it stays at the same line and moves the fi word only or create A or C or B random characters.
May I know please some commands to handle this bashrc file so that I could add a new line and then my variables over there?
I've tried to look online but didn't find what am looking for.
Since you didn't specify if you have terminal access only or also GUI. If you have terminal access only, any editor would do it. Popular editors like nano or vim come installed by default in most Ubuntu releases.
To use nano, in your terminal, type
nano ~/.bashrc
Then press Ctrl + w +v to go to the end, add what you want to add, the Ctrl + o to save changes, Ctrl +x to exit.
You will need to log out and log back on, or run source ~/.profile
to make your changes available to your bash environment.
Here's what you can do in vim.
G
. It will take you to the last line.O
. It will allow you to insert text after the current lne.export APP=/opt/tinyos-2.x/apps
ESC
key get out of editing mode.:
. It will allow you type commands.wq
followed by Enter. This will save the file and quit vim.You are done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With