The .bashrc file is a bash script file that executes in the following cases

  • using bash script execution
  • bash shell is opened and started interactively

This file is hidden by default because the file starts with . are hidden.

Where is the bashrc file in Linux?

The .bashrc file is the script that runs while the user logs in. It is located in the user’s home directory.

It contains environment variables and user preferences to be configured in this file.

How do I view a .bashrc file?

You can use Vi or Nano editor to view the bashrc file.

Following is a command

nano ~/.bashrc
nano ~/.bashrc

Where is the bashrc file located?

bashrc file is located in two places

  • user home directory
  • System directory

In the case of the user’s home directory, this file is hidden by default. The location is ~/.bashrc where ~ is a current user logged in the home directory.

In the case of the System directory, this file is located at /etc/bash.bashrc.

How to reload .bashrc settings without logging out and back in again?

if you make any changes to the .bashrc file, Changes are not reflected immediately. You need to close and restart the bash session to make changes.

How to reload .bashrc configurations without login in again? Run the following commands in the command prompt.

source ~/.bashrc

or shorter way using the below command

. ~/.bashrc

or execute bash again using the below command

exec bash

exec command reset the current session, and starts again.