Forums

I just deleted some files from /home/user accidentally...

Serious fail on my part. I messed up a script for a scheduled task and ran it on the wrong directory.

The files deleted were:

README.txt

.profile

.pythonstartup.py

.bash_history

.bashrc

.vimrc

.gitconfig

Are any of these important (probably)? How can I get them back?

Some things might work a little oddly without those files. I've put default versions of the important ones (.bashrc, .gitconfig, .profile, .pythonstartup.py and .vimrc) in a new subdirectory of your home directory. To copy them out, you should start a bash shell and (making sure you're in your home directory) run this command:

cp old-dotfiles/.[bgpv]* .

giles - Could you please put a copy of those files in my home directory? I accidentally deleted them as well trying to remote sync with my laptop.

No problem -- I've put them in an old-dotfiles directory of your home dir too, just use the command above to reinstall them.

Thanks, giles.

No problem!

You guys should definitely add a button to do this automatically. :)

It's funny -- just like the old saying about London buses, you wait for ages and then three come along at once... I don't think anyone's had this problem before, and now two people have on the same day! Presumably someone else is about to chime in :-)

Thanks for the quick fix, giles. I found it amusing that rhughes had this problem earlier today as well. go figure. happy new year!

giles, pretty sure this maybe related to my sync error where i wiped my home folder, but now when i try opening a new ipython notebook i see the following error:

Error loading notebook An unknown error occurred while loading this notebook. This version can load notebook formats v4 or earlier. See the server log for details.

any ideas?

one thing to try is to go to your process list on the console page and kill all the ipython notebook related stuff (eg: the jupyterhub and the kernel processes etc). and then try re-opening the ipython notebook.

thanks conrad! solved my problem.

Hi giles, I accidentally deleted the files as well...would it be possible to have those reloaded back into a directory for my account?

Edit - I don't know how the files reappeared, but they seem to all be there once again! Nevermind I guess! :D

That's very odd! I'm glad they came back, albeit a bit confused...

Hello, I mistakenly deleted theses as well... could I get them replaced too?

Edit: Nevermind, they appear to have come back ;-P

Hi giles, I accidentally deleted the files as well. Could you please add them back to my account? Thank you.

Edit: I signed up a new accout and copied code in each file. I think it works. thanks again <3.

This is what happens when you drink and code

Hi giles, I accidently damaged my .hashrc, can you please help me recover it or send me a copy of it. thanks

No problem. I have restored your .bashrc to the default.

Hi giles, I accidently damaged my .bashrc and the others, can you please help me recover it or send me a copy of it. thanks

We've recreated all missing default system files. If your .bashrc is broken you might use this snippet with our defaults:

# Load up standard site-wide settings.
source /etc/bashrc

#remove duplicate entries from history
export HISTCONTROL=ignoreboth

# Show current git branch in prompt.
function parse_git_branch {
  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
LIGHT_GREEN="\[\033[1;32m\]"
LIGHT_GRAY="\[\033[0;37m\]"

PS1="$LIGHT_GRAY\$(date +%H:%M) \w$YELLOW \$(parse_git_branch)$LIGHT_GREEN\$ $LIGHT_GRAY"

# Load virtualenvwrapper
source virtualenvwrapper.sh &> /dev/null

I did too, and every time I make a new console I get this error message:

: No such file or directory /etc/bashrc
/home/cat5/.bashrc: line 3: $'\r': command not found
/home/cat5/.bashrc: line 6: $'\r': command not found
/home/cat5/.bashrc: line 8: syntax error near unexpected token `$'{\r''
'home/cat5/.bashrc: line 8: `function parse_git_branch {
: No such file or directory
bash: $'\r': command not found
bash: $'\r': command not found
bash: /home/cat5/.bashrc: line 8: syntax error near unexpected token `$'{\r''
'ash: /home/cat5/.bashrc: line 8: `function parse_git_branch {

It looks like you've put Windows line endings in the file and that's what's causing the problem. If you delete the file and start a new console, it will be replaced