How to make custom alias in ~.bash_profile work on F10 86_64

Steve steve at lonetwin.net
Mon Dec 1 11:27:57 UTC 2008


oachim Backes wrote:
> Tim wrote:
>> On Mon, 2008-12-01 at 14:49 +0700, Yunus wrote:
>>> Is there other way to make my custom alias (put in ~.bash_profile)
>>> work?
>> 
>> Just curious, but do they work if you put them in "~/.bashrc"?
>> 
>> 
> 
> Or in /etc/bashrc.
> 
> Unfortunately, exporting aliases is not supported by bash (neither in 
> /etc/profile nor ~/.bash_profile) :-(

No ! that's not right ! Of course it is supported. Aliases can be defined anywhere /etc/bashrc, /etc/profile, /etc/profile.d/*, ~/.bashrc, ~/.bash-profile  ie: in any of the rc files.

Where exactly you put it in, defines whether it would be defined system-wide (in the '/etc/' files), for all bash instances (including scritpts) for a particular user (in the ~/.bashrc) or only for login shells for a particular user (in ~/.bash_profile).

Yunus: After adding the aliases to the file, you need to 'source' it into the current bash session to active the alias:

[steve at laptop ~]$ echo 'alias l="ls -al"' >> ~/.bash_profile
[steve at laptop ~]$ source .bash_profile              # or simply ". ~/.bash_profile" 
[steve at laptop ~]$ l

regards,
- steve
-- 
Linux Centric Marketplace: http://www.tuxcompatible.com





More information about the fedora-list mailing list