Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

For example, I love the ll command, which is not defined by default under Ubuntu, but is under openSuSE. I can manually enter:

alias "ll=ls -als"

but it will only be valid for the current shell. I want this to be valid for all users, all the time, remote or local connection.

Which file should I edit?

share|improve this question

You should put it under:


to be available to all users.

share|improve this answer
Yes. However, by titself under Ubuntu, this is not enough. I had to add the line "source /etc/bash.bashrc" at the end of th e/etc/profile file. – jfmessier Feb 6 '10 at 2:15
I didn't need to - it works for me – Jon Feb 6 '10 at 2:20

Try the /etc/profile file.

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

share|improve this answer
I tryed the alias command by itself there, and it was not running. As I was opening a new shell, the command was not available. However, by adding "source /etc/bash.bashrc" and the actual alias command at the end of that file, it was then working all fine. – jfmessier Feb 6 '10 at 2:17
up vote 3 down vote accepted

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.

share|improve this answer

As stated on the top of the file /etc/bash.bashrc:

 # System-wide .bashrc file for interactive bash(1) shells.
 # To enable the settings / commands in this file for login shells as well,
 # this file has to be sourced in /etc/profile.

So, both Jon and jfmessier are correct. Jon probably had /etc/bash.bashrc already sourced in /etc/profile, which seems to be the default case.

I would recommend to insert the alias commands in /etc/bash.bashrc and try to run them first, both with your normal user and with root. If they run as expected, you don’t need to source the file on profile. If they don’t, then source them.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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