PDA

View Full Version : What if .bashrc .bash_profile was deleted, how to restore bash profile?



Fli
04-05-2017, 11:54 PM
Hello,

i found that on the OpenVZ VPS during the time it was backed up, i lost /root/ directory contents.

So how i can restore bashrc file and other important dotfiles?

So far i found that this may work:


-bash-4.1# cp /etc/skel/.bash_logout ~/
-bash-4.1# cp /etc/skel/.bash_profile ~/
-bash-4.1# cp /etc/skel/.zshrc ~/
-bash-4.1# source ~/.bashrc

and after i exit the SSH session and re-enter it, i see my hostname on command line and also my custom aliases are persistent, not lost.

Custom aliases i added into ~/.bashrc
Here is .bashrc contents:


# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions
alias cp="cp -i"
alias mv="mv -i"
alias rm="rm -i"