Messed up your .bashrc file? Here’s how you can get your Linux desktop back

Last Updated on April 18, 2021 by admin

The .bashrc file, as you might already know, is basically a script that's executed whenever a terminal (or a new tab within a terminal) is launched in the interactive mode. This script includes a series of configuration commands related to the terminal session.

While it's okay to tweak the .bashrc file (located in home directory of the user) to suit your needs, sometimes users mess up the script, which leads to undefined behavior of the system. And sometimes, the problem even breaks your access to the terminal (and Desktop in some rare cases).

If you are on Ubuntu 14.04, and you've created a similar situation for yourself, and are now struggling to make things normal again, here are the steps that you can take to get back the original, unaltered .bashrc.

If you have access to the gnome-terminal application, launch the app and run the following commands:

cd [your-home-directory]
mv .bashrc .bashrc.old
cp /etc/skel/.bashrc .
sudo reboot

The idea here is to let you know that a clean .bashrc is also present at the /etc/skel/ location on your system.

PS 1: In case the gnome-terminal application is also not accessible, you can execute the aforementioned command in the Ctrl+Alt+F1 terminal.

PS 2: The solution mentioned in this tutorial should work on Ubuntu 16.04 LTS as well.

Leave a Comment