LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-22-2012, 06:58 PM   #1
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
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

Last edited by lleb; 12-22-2012 at 06:59 PM.
 
Old 12-22-2012, 07:40 PM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,613

Rep: Reputation: 433Reputation: 433Reputation: 433Reputation: 433Reputation: 433
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.
 
Old 12-22-2012, 08:14 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Better
Code:
echo "alias d='/bin/ls -laF'" > /etc/profile.d/z_local_aliases.sh
as that's what /etc/profile.d/ is for?
 
1 members found this post helpful.
Old 12-22-2012, 08:40 PM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Original Poster
Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
Quote:
Originally Posted by unSpawn View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to set global alias? exitsfunnel Linux - General 9 07-29-2014 10:12 AM
Nginx/Lighthttpd global alias? centosfan Linux - Server 0 06-08-2009 08:34 AM
Global alias help dirtmaster88 Linux - General 3 12-03-2008 11:09 AM
how do i set global alias in gentoo? lleb Linux - General 3 12-13-2007 02:38 PM
where to put global alias' true_atlantis Slackware 4 12-25-2003 03:31 PM


All times are GMT -5. The time now is 08:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration