Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
user@system~$ alias
OR
user@system~$ alias <alias_name>
user@system~$ alias hello
Similarly, add the same cmd in ~/profile or ~/.bashrc. For global setting, do the same in /etc/bashrc or /etc/profile. Then source .profile or .bashrc and check it again.
Code:
user@system~$ source .bashrc
OR
user@system~$ source .prifle
Last edited by shivaa; 02-05-2014 at 01:13 AM.
Reason: Formatting
user@system~$ alias
OR
user@system~$ alias <alias_name>
user@system~$ alias hello
Similarly, add the same cmd in ~/profile or ~/.bashrc. For global setting, do the same in /etc/bashrc or /etc/profile. Then source .profile or .bashrc and check it again.
Code:
user@system~$ source .bashrc
OR
user@system~$ source .prifle
Seems that those global files i.e. /etc/profile or /etc/bashrc ain't working in your case, because whenever your work, by default your own (per user) files are used (if they are available), not the global files. So you can do one thing: Define the same alias in your own files (~/.profile or ~/.bashrc) and check whether it work or not. Else, temporary move your ~/.profile or ~/.bashrc to some other place, logout from your session, and then login again and check those alias, bacause in that case system will read profile settings from global files.
What exactly did you do? Just add the same lines (i.e. alias hello='yes hello') in both /etc/bashrc and /etc/profile. Source these files and check it. Also, as far as I am concerned, each user will need to re-login to take changes into effect. Moreover, if it partially work, then append following entry in user's ~/.bashrc and ~/.profile file:
Code:
source /etc/profile
source /etc/bashrc
Note: After any change, source the file to take changes into effect.
What exactly did you do? Just add the same lines (i.e. alias hello='yes hello') in both /etc/bashrc and /etc/profile. Source these files and check it. Also, as far as I am concerned, each user will need to re-login to take changes into effect. Moreover, if it partially work, then append following entry in user's ~/.bashrc and ~/.profile file:
Code:
source /etc/profile
source /etc/bashrc
Note: After any change, source the file to take changes into effect.
When I typed source /etc/profile the alias was applied
But when I log off and log on , the alias was not applied
Well.. I guess Slackware doesn't use source command when logging on
# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
So, add your custom aliases to files (one for csh and one for bash) in /etc/profile.d/ and make them executable.
# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
So, add your custom aliases to files (one for csh and one for bash) in /etc/profile.d/ and make them executable.
The problem is that when a terminal is started in X, it is started as an interactive shell that is not a login shell. This means that at startup, bash reads commands from ~/.bashrc. (Read the INVOCATION section of 'man bash').
In my ~/.bashrc I have:
Code:
. /etc/profile.d/coreutils-dircolors.sh
so the aliases are loaded.
If you were to do this generally for all users, you could look at creating a .bashrc file in /etc/skel so that when a user was added, a default ~/.bashrc was added. The default .bashrc could contain:
Code:
if [ -f /etc/bashrc ]; then
source /etc/bashrc
fi
Then /etc/bashrc could be created to provide the aliases to all users.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.