Messed Up Your .bashrc file? How To Fix your Linux Desktop?[Fix]
My awesome Linux Users π I have a fix for you. Meanwhile check my blog category FOSS where I’ve several blogs on topics like Git, GitHub, GitHub Pages, Ubuntu, Jekyll, Linux, etc..
Technical blogs are always to the point. So for my daily blog viewers this must be new. But this is how technical blogs goes. I divide it into four sections:
- Technology Overview
- Problem Encountered
- Proposed Solution of a Tested Fix
- Related Posts
So Let’s learn to troubleshoot this issue which I faced while trying to tweak the .bashrc file from terminal.
Technology Overview
.bashrc File: Whenever Bash is run interactively the .bashrc script is run. This file is a place where all commands we enter in terminal are executed. It binds those commands and paths of the commands. Mostly the aliases are stored for execution. Also for users to execute any commands from their terminal can add the aliases in .bashrc file.
Problem Encountered
You might have messed up with your .bashrc file in performing your own tweaks. In my case I messed with the file by adding a PATH variable for Laravel. I added the script in the bottom of file. Saved the file. Than we need to compile the file using source command. I did source ~/.bashrc in terminal. Than something got screwed. Terminal now doesn’t execute any command. Type ls, dir,whoami, cd nothing works. So yours case might also be similar.
How to fix it then?
Solution
There are blogs which instructs us to restore the .bashrc.old file and perform a restart. This is how it is done:
cd [your-home-directory] mv .bashrc .bashrc.old cp /etc/skel/.bashrc . sudo reboot
But that solution works if messing up with .bashrc file caused some other issues like, unable to see the desktop and running other commands. In my case the terminal commands were not working. So I used virtual terminal.
- To enable Virtual Terminal pressΒ Ctrl _ Alt + F1 keys
- Perform login with your system username and password
- Now, first undo all your changes in .bashrc file.
- Do nano ~/.bashrc and either delete the changes or just comment it by adding # in front of the line
- Save the changes and get out of that file. Ctrl + X and Yes(Y)
- Now compile the file with command source ~/.bashrc
- Reboot your system.
This will compile the changes and you will get back your terminal commands in your interactive terminal. This worked for me. I am using Ubuntu 16.04 currently. This will work on any distribution version of Ubuntu.
Now let me continue bugging my head with Laravel Installation in my freshly installed Ubuntu 16.04LTS.
Related Topics:
- How To Upgrade Ubuntu With a Single Command?
- UBUNTU 16.04: How to Completely Reset Wifi Settings?
- How to download, pause and resume file from any URLβs via terminal?
- Troubleshoot your dead screen in Ubuntu with LightDM.
- How to Install Java8 in Ubuntu With PPA?
Today’s article on troubleshooting a Linux issue of .bashrc file is sixty-fifth day of my daily writing commitment. Please go through them and share your comments. If you like any of my blogs than please share it with your friends. Cheers!
Hello Sanjog. A linux user here. π But I came here for something else. To let you know what I think. And I think you are doing great! You have ,in my view, scored “first division” score in your daily challenge so far. Congrats.
Keep going!! π
Thank You Human π Yeah, I scored 65 percentage so far and I’m aiming to score distinction. If the distinction score is achieved than we can go for a hundred percent result π Keep supporting me please.
As Your Email ID Says “I don’t want you to know” π Well that’s a cool id. Can you share how can I get such id? You don’t have to say your name for it, do you ? π