Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Possible Duplicate:
Undo an “rm -rf ~” command?

So I made a stupid error, I did a sudo rm -rf of my ~/ directory. I wasn't thinking of the hidden files in there. Now instead of showing what directory I'm in, or my username it just says -bash-3.2$ where it used to say: [username@host location]$ What I am wondering is there a way to regenerate these files so that it shows folder location and my username, etc. Thanks.

share|improve this question

migrated from Oct 25 '12 at 20:27

This question came from our site for professional and enthusiast programmers.

marked as duplicate by slhck Oct 25 '12 at 21:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

look for programs that try to recover deleted files from hard disk. Make sure to make as few changes to your hard disk as possible, as you may overwrite some of those files. – Shahbaz Oct 25 '12 at 19:25

There is no way of recovering those files (unless you have done a backup - which you should do!).

Try copying the files .bashrc etc from another users account. If you do not have another users account, create one and login. Bash will recreate these files for you.

share|improve this answer

In your ~/.bash_profile file, add the line

export PS1='\u@\h \w $ '
share|improve this answer
I don't have access to upvote, but that fixed it! Thank you!! – coldcoder Oct 25 '12 at 19:37

rm -f ~/ would not have deleted your hidden files, but in your case only option is recovery of those files.

I am not sure whether it will help or not, but you can check Here

share|improve this answer
Yes, rm -rf ~/ would remove hidden files. Files whose names start with . are hidden from ls and from shell wildcard expansion; they're not hidden from a recursive rm. – Keith Thompson Oct 25 '12 at 19:29

Restore from backup.

Failing that, the original files copied to the home directory of a new user usually reside in /etc/skel/.

share|improve this answer

Copy the files from /etc/skel to your home directory. That will at least restore you to the dot files state of a new user. Including your .bashrc

share|improve this answer

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