Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am just curious about what would happen if I delete the ~/.bashrc file of a user. Does even the root user have their own ~/.bashrc file? What if I delete that, or can I?

share|improve this question
If a sysadmin deleted my ~/.bashrc file, I'd probably get a bit pissed off. Then I'd restore it from a snapshot. – Digital Trauma Jan 25 at 1:53
Nice question, is this related to a specific situation or just a theoretical question? – JimLohse Jan 25 at 2:52
this is just random curiosity :d – juggernaut1996 Jan 25 at 10:39
up vote 25 down vote accepted

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/.

share|improve this answer
It's probably worth noting that if you remove /etc/bash.bashrc file, bash will resort to defaults stored in source-code. That version of shell might lack some fancy features (colors, useful prompt, tab-completion), but will be otherwise usable. – Mirosław Zalewski Jan 24 at 19:47
If I am not wrong, bash --rcfile /etc/bash.bashrc and bash --norc commands should let you see how bash would look (accordingly without only ~/.bashrc file and without both /etc/bash.bashrc and ~/.bashrc) without deleting files. – BartekChom Jan 24 at 20:05
Something special happens haha all the users customizations go away and they get mad at you! :) – JimLohse Jan 25 at 2:39
  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.

share|improve this answer
This doesn't answer the main question: what wold happen – Darkhogg Jan 24 at 19:53
@Darkhogg Hey my friend.Thanks for pointing out. I have updated my answer. – Raja Jan 25 at 0:38
Copying the default "skeleton" .bashrc doesn't really "restore" it the user's .bashrc, it just gives the user a fresh new default file with none of his personal edits. That's seems a little like slashing an artist's painting and giving him a new blank canvas and telling him you've "restored" his painting. – Johnny Jan 25 at 18:53

If you delete a user's .bashrc and they put work into it, they will get really mad at you!!! Just back it up / move it aside by using mv ~user/.bashrc ~user/.bashrc.orig

The "what will happen" has been addressed in other questions, the user will still be able to log in, using the system default profile, assuming you're in Ubuntu that's covered here: Restore .bashrc to its default?

That question is possible a duplicate of this one that also provides the info (as do other answers here) about /etc/skel How to restore .bashrc file?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.