You are not logged in.

#1 2010-06-11 02:29:10

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Where to put aliases instead of in ~/.bashrc for systemwide effect?

I'd like to make a systemwide alias instead of putting the alias in each users .bashrc file. Where should i put it?

Thanks!


joe@trusktr.io - joe at true skater dot io.

Offline

#2 2010-06-11 02:31:21

bmccosar
Member
Registered: 2010-06-09
Posts: 1
Website

Re: Where to put aliases instead of in ~/.bashrc for systemwide effect?

I am a new Archer, but I'll take a shot at it . . .

/etc/profile.d

I see a lot of environment variables being set there.  Makes sense alias would work there as well.

Offline

#3 2010-06-11 02:44:19

leftylink
Member
From: Secure and undisclosed
Registered: 2009-01-25
Posts: 23

Re: Where to put aliases instead of in ~/.bashrc for systemwide effect?

The systemwide .bashrc file is located at /etc/bash.bashrc

It also sources /etc/bash.bashrc.local, so I'd say the proper thing to do here is to create that file and put whatever you need to in there, so that upgrades that change /etc/bash.bashrc won't complain about a changed file.

The previously mentioned /etc/profile.d/ should work just fine too.

Last edited by leftylink (2010-06-11 02:46:42)

Offline

#4 2010-06-15 08:58:49

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Re: Where to put aliases instead of in ~/.bashrc for systemwide effect?

hanks guys! Got it working. smile


joe@trusktr.io - joe at true skater dot io.

Offline

#5 2010-06-17 02:26:29

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: Where to put aliases instead of in ~/.bashrc for systemwide effect?

Another option is to put the aliases in a file by themselves, then include them in each user's .bashrc file you want them in with

source /opt/aliases

(or wherever they are)

This has the advantage that not all users are necessarily affected, and you still only need to edit the one file.

Offline

#6 2010-06-17 02:33:34

andresp
Member
Registered: 2010-05-29
Posts: 62

Re: Where to put aliases instead of in ~/.bashrc for systemwide effect?

You should put them in bash.bashrc like someone else said, and not source it since the arch bash package has configured interactive shells to do that automatically.

Likewise, comment the section in profile.bash that sources it. Among other things, you end up running /etc/bash_completion twice. When using straight vc, sticking to tmux means interactive shells. The login shell should just set exports.

Offline

Board footer

Powered by FluxBB