LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 05:58 PM   #1
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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 05:59 PM.
 
Old 12-22-2012, 06:40 PM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
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, 07:14 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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, 07:40 PM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Original Poster
Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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



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 09:12 AM
Nginx/Lighthttpd global alias? centosfan Linux - Server 0 06-08-2009 07:34 AM
Global alias help dirtmaster88 Linux - General 3 12-03-2008 10:09 AM
how do i set global alias in gentoo? lleb Linux - General 3 12-13-2007 01:38 PM
where to put global alias' true_atlantis Slackware 4 12-25-2003 02:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:34 AM.

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
Open Source Consulting | Domain Registration