1

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.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Jairo Alves
  • 141
  • 5
  • 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](https://unix.stackexchange.com/a/38331/90751) as well as [how to see what's happening in `bash`](https://unix.stackexchange.com/a/38363/90751). 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 COMMAND`part, 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

2 Answers2

1

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

Jairo Alves
  • 141
  • 5
0

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)

imabug
  • 151
  • 1
  • 1
  • 5
  • 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