Adding an alias to .bash_profile removes other commands?

Adding an alias to .bash_profile removes other commands?

Before touching .bash_profile:

mongod launches a mongo server, rabbitmq-server launches a rabbit server, etc.

But once I add:

alias ethertunes="sudo NODE_ENV=development nodemon --debug ~/ethertunes/src/cluster/launcher.js"

all my other commands are gone. (Still have ls and CD and such though...)

What am I doing wrong?

答案1

Are your other aliases and such defined in ~/.profile? If so, that'll be overridden by ~/.bash_profile, so everything in .profile becomes unavailable. Solution: merge them; put all your definitions into a single profile file, rather than having them split between two files. It doesn't really matter which name you use (.profile or .bash_profile) unless you have commands that depend on bash extensions -- in that case use .bash_profile.

Another possibility is that your old definitions were in .bash_profile, and when you added the new command you replaced (rather than adding to) the old contents. In this case, you have to either look for a backup or set about recreating whatever you had in there.

相关内容