0

In Ubuntu 14.04 each time I reboot, the bashrc file is missing in the ~/. location.

What happened? Please give me some suggestions! Thanks!

Update:
Add new ~/.bashrc, then ls -l ~/.bashrc get the output -r--r--r-- 1. So chmod 644 ~/.bashrc get output -rw-r--r-- 1.Then every reboot, solved the problem that missing file. But I still need to source the file like: . ~/.bashrcto get every thing works.

3
  • 1
    please clarify when it happens. in the title you say, when you open a new terminal - in the question you say, when your reboot
    – TmTron
    May 31, 2016 at 7:24
  • 1
    one reason could be that some other script/process deletes it. Try to make it readonly chmod 444 ~/.bashrc and re-login, just to see if this works. note: to restore the original (rw-r--r--) permissions use: chmod 644 ~/.bashrc
    – TmTron
    May 31, 2016 at 7:24
  • thx @TmTron, the missing file problem solved. but each time reboot or open a new terminal, still need to source ~/.bashrc to get every thing work.
    – crazymumu
    May 31, 2016 at 8:26

1 Answer 1

1

Check if your ~/.profile script is okay. Per default ~/.bashrc should be loaded automatically by ~/.profile like this:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi
3
  • where is the .profile located? I found /etc/profile, and add the code you given. How do compile this script? thx
    – crazymumu
    May 31, 2016 at 9:25
  • I mean the .profile in your users home-directory (I've updated the answer). Stuff in /etc/ is for system-wide settings. There's no need to compile anything. It's a script and thus interpreted.
    – TmTron
    May 31, 2016 at 9:33
  • really appreciated for your help. it works. btw, change the code in /etc/profile works too. consider about that was system-wide. may be your choice is much better.thx.
    – crazymumu
    Jun 1, 2016 at 1:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .