What if I delete ~/.bashrc file of a user?

If you delete a user's ~/.bashrc nothing special happens. Bash will still start and use the system-wide /etc/bash.bashrc.

Just like any user root may or may not have a ~/.bashrc, and if it exists you can delete if you have write permission on /root/.


  1. You cant remove root user .bashrc file unless you are root user.

  2. In case if .bashrc file deleted for your account then you can restore it with

     cp /etc/skel/.bashrc ~/.bashrc
    

But this is not your old .bashrc file. It's a new .bashrc file with default configuration.

Update: Curiosity and over Curiosity

There is no problem as menioned in above answer if you have deleted .bashrc file. Your system will be using system wide /etc/bash.bashrc file and run as usually.

But If System wide /etc/bash.bashrc file is using by your system then no aliases , no auto tab completition , no colors.Nothing will work for you.

In case of over curiosity if you have deleted system wide /etc/bash.bashrc then also no problem, but the only feature that misses here is if you type some command which is not avaliable we used to get command-not-found but after deleting system wide bashrc you wont get even that.

That's all I know for now.

Hope it helps.

Tags:

Bashrc