LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   setting global alias for all users howto??? Fedora 18 (https://www.linuxquestions.org/questions/linux-newbie-8/setting-global-alias-for-all-users-howto-fedora-18-a-4175442604/)

lleb 12-22-2012 05:58 PM

setting global alias for all users howto??? Fedora 18
 
in the past i have just edited the .bash_profile for the user and added my alias's i want for each user.

under Fedora 18 i have done so for both the user of the laptop and for root (for me) with the following alias:

alias d='ls -laF'

real simple. nothing fancy, nothing crazy.

When i start the terminal withing Gnome the user has no access to the alias, but if i su - then root does. what gives?

More importantly what file(s) do i need to edit to make this simple alias for all users including new users created down the line?

Thanks.


Code:

$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin
alias d='ls -laF'

export PATH

Code:

# cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
alias d='ls -laF'

export PATH


malekmustaq 12-22-2012 06:40 PM

Define a universal /etc/bash_profile in the system effective and readable for all users; or, declare the aliases at the /etc/profile. This is what directory '/etc' is for.

Hope that helps.

Goodluck.

unSpawn 12-22-2012 07:14 PM

Better
Code:

echo "alias d='/bin/ls -laF'" > /etc/profile.d/z_local_aliases.sh
as that's what /etc/profile.d/ is for?

lleb 12-22-2012 07:40 PM

Quote:

Originally Posted by unSpawn (Post 4855217)
Better
Code:

echo "alias d='/bin/ls -laF'" > /etc/profile.d/z_local_aliases.sh
as that's what /etc/profile.d/ is for?

fantastic. thank you much for the help, both of you.


All times are GMT -5. The time now is 10:59 PM.