Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I would like to have

alias ll="ls -l"

to be system wide.

How is that done on Ubuntu?

share|improve this question

closed as off-topic by Magellan, Jenny D, mdpc, Nathan C, Scott Pack Oct 11 '13 at 0:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Magellan, Jenny D, mdpc, Nathan C, Scott Pack
If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 12 down vote accepted

Add it in to /etc/bashrc. This will (or should) get called on login by every user who uses bash.

share|improve this answer
My machine (Ubuntu 12) doesn't have /etc/bashrc or any references to it in /etc/profile, ~/.bashrc or elsewhere. The place I found that was best to do this, decoupled from the system's files and thus better for maintaining customizations with something like Puppet, is to place a file in /etc/profile.d/ – Spanky Dec 4 '13 at 18:11
# echo "alias ll='ls -l'" >> /etc/bash.bashrc

and make sure that this file is executed whenever an user enters a shell by adding the following in ~/.bashrc:

# Source global definitions
if [ -f /etc/bash.bashrc ]; then
    . /etc/bash.bashrc
share|improve this answer
This answer was helpful. In Ubuntu 14.04, when I opened my .bashrc file, near the end, there's a pre-created section similar to the if [...] @quanta mentions, except is uses .bash_aliases. All I had to do is echo the alias into echo "alias ll-'ls -l'" >> ~/.bash_aliases since .bashrc already had something setup in this environment. And I closed/re-opened putty. – jmbertucci Jan 4 '15 at 19:50

If your user's $HOME/.bashrc contains the usual

if [ -f /etc/bashrc ]; then
        . /etc/bashrc

Then put it in /etc/bashrc. If it doesn't then put it in /etc/profile from where it will at least be read for login shells.

share|improve this answer

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