Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

3 Answers 3

up vote 6 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

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

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

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
# 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
fi
share|improve this answer

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