How To Restore .bashrc File To Default Settings In Ubuntu
I have a Ubuntu VM which I often use it to test a lot of applications and write articles about them here in my blog. Yesterday, a while ago I stumbled upon an useful system configuration application called “Ubunsys”. While testing it, I messed up with the .bashrc file when try to show hidden startup items. Every time I open the Terminal, It displayed an error message something like below:
-bash: /home/sk/.bashrc: line 68: syntax error near unexpected token `)' -bash: /home/sk/.bashrc: line 68: `xterm*|rxvt*)'
The VM was actually for testing purposes, so I could easily delete it and create a new one in couple minutes. But, I don’t want to do that. While searching for a suitable solution, I came across a reliable answer in AskUbuntu that described how to restore .bashrc to its default settings. I followed it, and fixed the issue within few minutes. For those wondering, here are the steps to restore your .bashrc file to default settings in Ubuntu.
Restore .bashrc File To Default Settings In Ubuntu
As you might already know, there is a default version of the .bashrc file in the /etc/skel/ directory in Ubuntu. So if you have problems with .bashrc file, you can easily restore it to its default settings as described below.
First, backup your current .bashrc file using command:
$ cp ~/.bashrc ~/.bashrc.bak
Then, copy the default version of .bashrc file to your current version like below:
$ cp /etc/skel/.bashrc ~/
Finally, run the following command to update the changes.
$ source ~/.bashrc
So, if you unknowingly put some crap in your .bash_profile or .bashrc files, follow the above steps to restore them to the default value. I tested this in Ubuntu 16.04 LTS, and worked fine. I hope It will probably work on other Ubuntu versions and derivatives.
And, that’s all. If you find this guide useful, please share it on your social, professional networks, so that other users can also benefit from it. More good stuffs to come. Stay tuned!
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!