Bash initialization gone wrong


Today i tried to set some global aliases. The /etc/profile said that i should do that in /etc/profile.local .
I create /etc/profile.local, set the aliases, then i reboot.
Now i’ve got a broken bash enviroment. Prompt has gone, ls colors gone, useful aliases (md=mkdir) gone…
I’ve got this prompt: ‘bash-4.0$’ instead of the ‘username@hostname:actual dir’
The root account has got the same errors, so i think i broke something system-wide.
I removed the profile.local but the problem stays.
What should i do to regain the standard bash enviroment?

First you must decide if those aliases are for the user or for the whole system. Normaly the aliases are only for the particular (even if it is the only one on the system) user. Then you never change anything in /etc for that, and now you see why. So revert those changes (I suppose you made copies of the files you changed before you did so).

Then when you are loged as the normal user look if there is a file in your home directory called* .alias* (mind the . at the beginning). If there is one edit it and add your new aliases. If there isn’t one create it and add the same.

I’ve found that root tends to follow /etc/profile and /etc/profile.local, while regular users will follow /etc/bash.bashrc and /etc/bash.bashrc.local

It is a bit strange imho to make this statement. Users (including root) do not ‘tend’ to do things. They run processes (in this case bash) and that program acts in the way it is programmed to do. And how bash behaves when it starts with respect to reading/executing startup files can be found in

man bash

in the paragraph INVOCATION. There is nothing there about tending to do something on sundays or when the process owner is root.


I’ve found the solution: somehow i’ve deleted /etc/bash.bashrc . I downloaded a fresh 11.2 and copied the file back.
And yes, the root user also uses /etc/bash.bashrc for example: to color the root prompt

Strangely, opensuse wiki does not mention the /etc/bash.basrc file :open_mouth:

edit: My global aliases also work :slight_smile: I’ve put them to /etc/bash.bashrc.local
A moderator could mark this thread solved.