Tweaking your Bashrc file

Tweaking your Bashrc file

Tweaking your Bashrc file and making it your own is something that most of us have done form time to time. You can have a lot of things in it or you can go minimalist. The Bashrc file can do a lot of things – from changing the colors of your prompts to helping with aliases and much more. Deciding on what you want in it is your choice.

Here are some things that I have come up with:

Here are some of the aliases that I use. When I type VI for instance I really want VI Improved (VIM) so I put that in my file.  I even put in cd.. (Which is not going to get me results) but with a bit of alias magic it turns into cd .. and things work out. You can come up with your own aliases or use some of mine.

There is also a section that deals with auto root. If I am not root then it will use the sudo command for several things. All of this is to make life easier for me when I have the Bashrc file in my home directory. There is also a section for History and what I want done with the history of my Bash keystrokes to be.

We talked about changing the colors for the Bash prompt in another article. Here it is in my Bashrc file.  I can immediately tell if I am Root by the color changes to the prompt.

I have listed most all of the common file types (you may want more) and the colors them to be. You can change and add to them as you see fit. We went over these in a previous article.

Conclusion

The Bashrc file can do a lot to change the environment at the command prompt. It depends on how you use it. If you have a lot of aliases in your file and it starts to get a bit unruly, you can put them into ~/.bash_aliases.  There are numerous examples of Bashrc files on the internet. Take a look at them and learn from the examples. My bashrc file (a from my github. is here) has gone through many changes (134 and counting), so don’t be afraid of changing things up.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 4

No votes so far! Be the first to rate this post.


Leave a Reply

Your email address will not be published. Required fields are marked *


Updated on November 15, 2021

Pixelated Dwarf