Edit “bashrc” on Linux for Color Prompt


The bashrc report in Linux is a configuration report containing configurations associated with the gadget’s terminal. This report is performed each time you log into your Linux gadget. By making other adjustments to this report, you’ll simply customise your Linux terminal inside seconds. This comprises converting the colour of the suggested, taking part in round with the fonts, converting the consumer names that seem at the terminal, and many others. For this actual dialogue, we’re taken with learning the process of enhancing the bashrc report for converting the colour of the suggested in a Ubuntu 20.04 gadget.

Method of Editing “bashrc” for Changing the Color of the Prompt in Ubuntu 20.04:

Along with providing more than one different terminal customization choices, the bashrc report in Linux will also be edited to switch the suggested’s colour. For studying the process of doing so, you’ll have to cross throughout the next steps. However, we want to point out previously that on this manner, we can first train you the way to create a backup of the default settings so that you could all the time repair them each time you wish to have. After that, we can percentage with you the process of fixing the colour of the suggested, and for that, we have now shared rather a couple of examples so that you could see how the suggested will appear to be after converting its colours. Finally, we have now taught you the process of restoring the default suggested colour in Ubuntu 20.04. So now, allow us to get began with the next steps:

Step # 1: View the “bashrc” File in your Ubuntu 20.04 System:

The bashrc report can simply be considered on a Ubuntu 20.04 gadget by means of the usage of any textual content editor of your selection. Here, we’re going to use the nano editor for this objective, and we can open the bashrc report with the assistance of the command proven beneath:

The bashrc report of our Ubuntu 20.04 gadget is proven within the following symbol:

In this report, the phase by which the attributes of the variable PS1 are outlined is essential for us. Basically, this variable permits you to customise your terminal in different alternative ways, in conjunction with converting the colour of the suggested, which we can be told later on this article.

Step # 2: Take a Backup of the Relevant Variable of this File:

Now, for converting the colour of the suggested in Ubuntu 20.04, we can be making some adjustments to the PS1 variable. However, prior to doing so, it’s extremely beneficial that you’re taking a backup of that variable in order that if you happen to reduce to rubble with anything else all the way through this entire procedure or even supposing you simply need to return to the default suggested colour, you are going to simply have the ability to do this. For that, we can be copying the price of the PS1 variable to some other variable. You can assign any title of your option to this variable. The command proven beneath will serve this objective:

This command will merely assign the default worth of the PS1 variable to the TEMP variable, from the place it may be restored later. This command is not going to generate any output upon a hit execution.

Step # 3: Change the Color of your Ubuntu 20.04 Prompt from Green to Red:

Now, when we have now taken a backup of our PS1 variable, we will simply exchange it to switch the colour of our Ubuntu 20.04 suggested. The default colour of our Ubuntu 20.04 suggested is inexperienced. In this step, we can merely try to exchange this colour to crimson. For that, we can execute the below-appended command:

$ PS1=“[

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More