what is .bashrc file in linux and how does it works?

In Linux, bashrc is a script file. This script file execute when the terminal is open. It is responsible for the terminal operations.

What is .bashrc file? | How to use it? | with Examples

what is .bashrc file in linux
.bashrc file in Linux

Hello, guys welcome to the next session on Linux command line tutorial.

In this session, I'm going to talk about ".bashrc" file in Linux.

What is ".bashrc" file?

The ".bashrc" file is a script that is executed whenever a "New terminal" session is started in interactive mode.

Location of .bashrc file

First of all, You open your terminal and just check whether you are in your home directory or not.

By default, you are already in the home directory. Whenever you open your terminal.

to list .bashrc file
.bashrc file

In here you can just write "ls -a" for listing all "hidden files" and you will be able to see there is a file called ".bashrc".

This is the file which is responsible for whenever you open a new terminal this file is executed.

This is a kind of a "script" that is executed first whenever you open a new terminal session.

Open .bashrc file

Let's go inside this ".bashrc" file. So you can use "nano" command to display the content of this ".bashrc" file.

edit .bashrc file using nano text editor
edit ".bashrc" file using nano text editor

$nano .bashrc
Just write "nano .bashrc" and you can go inside this file and you can see the content of this file.

What is the purpose? How to use it?

This "script" is executed whenever you open a new terminal. So whatever you add to the script it will be executed first whenever you open a new terminal session.

.bashrc scripting in linux using nano text editor
Example script

  • Let's add some "welcome text".

So you just need to go the end of this file.

For example, echo "Hii, welcome to Linux" and close the editor.

Now I'm going to open a new terminal session.

.bashrc script in linux
New terminal

The text I have written in the ".bashrc" file is executed.

So using this we know that this ".bashrc" file is called first because it's executing our "echo" command also and then your normal terminal operation.

Conclusion

So in this way you can customize your ".bashrc" file mostly we use this .bashrc file for a number of things.

For example, You install Java you need to set up the Java home environment variable and this can be done using this ".bashrc" file.

I hope you understood the basic concept of ".bashrc" file.

I hope you enjoyed this tutorial please rate comment and bye.

HAVE A NICE DAY💖

Related,

Name

Apps,3,Games,1,Linux,38,Linux Commands,37,Terminal Apps,2,Termux,17,Userland,3,Windows,1,
ltr
item
Pro Tech guides: what is .bashrc file in linux and how does it works?
what is .bashrc file in linux and how does it works?
In Linux, bashrc is a script file. This script file execute when the terminal is open. It is responsible for the terminal operations.
https://1.bp.blogspot.com/-UCeL9H8CIbo/YAGgQRPcPII/AAAAAAAAC-g/GHmduajYSO0jBGpRMxFQDIisITKE16TPQCNcBGAsYHQ/s16000/bashrc-file.jpg
https://1.bp.blogspot.com/-UCeL9H8CIbo/YAGgQRPcPII/AAAAAAAAC-g/GHmduajYSO0jBGpRMxFQDIisITKE16TPQCNcBGAsYHQ/s72-c/bashrc-file.jpg
Pro Tech guides
http://www.protechguidez.com/2021/01/what-is-.bashrc-file-in-linux.html
http://www.protechguidez.com/
http://www.protechguidez.com/
http://www.protechguidez.com/2021/01/what-is-.bashrc-file-in-linux.html
true
7053638852026728047
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content