Add Line to Bashrc Ubuntu: Quick Guide

To add a line to your bashrc, follow these steps:

  1. Open the terminal and use a text editor (like nano or vim) to open the bashrc file. For example, using the nano editor:
nano ~/.bashrc
  1. At the end of the file or in any appropriate location, insert the command line as desired. For example, suppose you want to add a command that sets an environment variable:
export MY_VARIABLE="my_value"
  1. Save and close the file. In the nano editor, press Ctrl + X, then press Y to confirm the save.
  2. Update the bashrc file for the changes to take effect. Run the following command in the terminal:
source ~/.bashrc

You have successfully added a line in bashrc. You can now run the newly added command in the terminal or use the newly set environment variable.

bannerAds