LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-30-2018, 03:18 PM   #1
wrmosca
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Rep: Reputation: 0
Creating Alias for all users


I've searched through several posts about aliases for all users and keep getting "Put it in the /etc/skel/.bashrc".

Fine, I understand that, but when I type the command "alias" I get a list of what is in the .bashrc plus some others that I can't find anywhere such as:
alias vi='vim'
-or-
alias grep='grep --color=auto'

I love those and would like to add them to a new server, but I can't see where they were originally created on the old server.

Any help on where these little suckers exist?
 
Old 04-30-2018, 03:35 PM   #2
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Probably in one of the scripts at /etc/profile.d/ or in /etc/profile itself.

For example on slackware, the file /etc/profile.d/coreutils-dircolors.sh is responsible for setting
Code:
alias ls='/bin/ls $LS_OPTIONS'
You could easily find which script is setting an alias by running something like:
Code:
$ grep alias /etc/profile{,.d/*}
Using /etc/skel/ can be useful, but only newly created accounts will copy over a template of .bashrc for example. If you placed aliases in /etc/profile these should be set for all users, regardless if the account already exists.

Last edited by coralfang; 04-30-2018 at 03:43 PM.
 
1 members found this post helpful.
Old 04-30-2018, 04:07 PM   #3
wrmosca
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Original Poster
Rep: Reputation: 0
Perfect! Thanks, coralfang. That found a bunch of .csh and .sh files in /etc/profile with the aliases I was looking for.
 
Old 05-01-2018, 09:50 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
since we're talking about bash it seems, they could also be in /etc/bash.bashrc
 
Old 05-01-2018, 11:13 AM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Quote:
Originally Posted by ondoho View Post
since we're talking about bash it seems, they could also be in /etc/bash.bashrc
caveat: not every distro supports a system-wide bashrc out of the box, and even those that do can't agree on its name, i.e. /etc/bashrc vs /etc/bash.bashrc.
 
Old 05-01-2018, 12:09 PM   #6
wrmosca
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Original Poster
Rep: Reputation: 0
I do have a /etc/bashrc file. At the top the comments say:
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
 
  


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
creating alias for normal users nblab Linux - Newbie 2 10-08-2012 12:40 AM
[SOLVED] I need help with creating a certain alias please help, thanks... BMan8577 Linux - Newbie 3 04-29-2011 07:56 PM
creating alias kaplan71 Debian 2 03-20-2008 12:14 PM
trouble creating alias coldbeerz Linux - Newbie 4 11-19-2007 10:37 AM
Need advice on creating an alias thorney Linux - General 2 11-27-2005 07:33 PM

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

All times are GMT -5. The time now is 05:04 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