This question already has an answer here:

I'm a CentOS user. In my machine, some aliases are available, they were previously defined in the past. I want to add new aliases to function as shortcuts to frequently used commands.

I don't know where to define them, since I'd like them to be in the same file as the already defined aliases. I've searched files like bashrc, /.rc, but it wasn't there.

I've checked the already defined aliases are available to all users, not just mine.

marked as duplicate by JigglyNaga, Community Nov 13 '18 at 14:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Using the reference to this question, I tried what they suggest: ~/.bashrc ~/.bash_profile /etc/bashrc /etc/profile still could not find it. – Jairo Alves Nov 13 '18 at 13:09
  • The answers to that question suggest more places to look as well as how to see what's happening in bash. Did you try those? – JigglyNaga Nov 13 '18 at 13:12
  • You're right. I'm going to try them sequentially.Tried the grep -r '^alias COMMAND' /etc but it does not find it. I can't try the unalias COMMANDpart, because if it erase the current aliases I could not restore to the current state, and that would be even worse. I'll check the other answers as well. – Jairo Alves Nov 13 '18 at 13:15

Some shell command aliases are built in. Define your own by putting them in the relevant rc file for the shell you're using (i.e. .bashrc if your shell is bash)

  • In this case, the commands I'm refering to are custom. They are like little shortcuts to some local scripts. Now I'd like to add new shortcuts to other scripts. Or it could be also to edit the current alias in case they needed an update. – Jairo Alves Nov 13 '18 at 13:14

Thanks to the tips on this question as suggested by JigglyNaga.

I tried the bash -v / bash - x and found out that the place the my aliases were defined is: /etc/profile.d/login.sh

Not the answer you're looking for? Browse other questions tagged or ask your own question.