Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  Dedicated Server FAQ  >  How To Fix Corrupted Bash (.bash_profile) on Linux.
Top Scroll

How To Fix Corrupted Bash (.bash_profile) on Linux.

 2 min

 

Today we will see the process of reinstating a corrupted bash (.bash_profile) in a quick and an easy way. Simply follow the steps given below and recover your corrupted bash profile.

Log into your server via SSH and check for the below mentioned files, because if they aren’t present then you need to create them on the server one-by-one.

File 1.  # cat /root/.bash_profile

File  2. # cat /root/.bashrc

File  3. # cat /root/.bash_logout

——————————–

Be very sure to create the above missing files and enter the code in each as given below.

Now edit the file with your favorite editor. I’ll be using vi editor here.

 

1.  Command –

# vi /root/.bash_profile

CODE:

————————————————–
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME
————————————————–

 

2.   Command –

# vi /root/.bashrc

CODE:
————————————————–
# .bashrc

# User specific aliases and functions

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

 

3.  Command –

# vi /root/.bash_logout

CODE:
————————————————–

# ~/.bash_logout

clear

————————————————–

Now logout and log-in again to confirm the changes.

***

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.