Home » Questions » Computers [ Ask a new question ]

Under Ubuntu, how can I place a shell alias command that will be global to everyone?

Under Ubuntu, how can I place a shell alias command that will be global to everyone?

Under Ubuntu 9.10, where can I place an alias command that will be valid to all users, root or otherwise, and that will work with a shell under GNOME as well as an ssh session and plain console login ?

Asked by: Guest | Views: 329
Total answers/comments: 2
Guest [Entry]

"Actually, I found that the answer, at least for me, is a combination of two previous answers. I found that the following was working for me:

The file /etc/profile is indeed executed, but the alias commands there are not working. I understand that the alias command there is only valid while the shell process is executed. Looking at the file /etc/bash.bashrc, I read at the top of the file that the file has to be ""sourced"" from /etc/profile.

So I added the alias command that I wanted in /etc/bash.bashrc first. like:

alias ""ll=ls -als""

Then I appended the source command at the end of /etc/profile:

source /etc/bash.bashrc

It seemed to be working fine in both a shell locally launched and one from an SSH connection."
Guest [Entry]

"Try the /etc/profile file.

This is intended for system-wide initialisation of the Bourne shell and compatible shells."