adding permanent aliases to profile
hello ;D
HOWTO add permanent aliases into the bash profile? I added them just like that, like a command. when I restart my box, the aliases are no more. I didn't however edit /etc/profile cuz I was affraid. (I was puzzled that it wasn't .profile, like my friend mentioned it should be) I made a /home/[username]/profile and a /home/[username]/.profile just in case as well. Any idea? BTW, I have Ubuntu Badger TNX :D |
Don't worry too much about the name. There are often minor variations between distributions. Debian has /etc/profile also.
You also don't need to be that afraid to edit the things. They're just textfiles. Simply make a copy of it before you change anything, and if you have problems you only have to put the old one back in place. BTW, there are actually several places you can put aliases. /etc/profile is where you'd put systemwide settings. But there's also /etc/.bashrc (actually /etc/bash.bashrc on my system), for aliases that will only appear in gui bash shells. I've found that sometimes you have to put aliases in both /etc/profile and etc/bash.bashrc to have access to them in all environments. ~/.bash_profile and ~/.bashrc in your home directory are for things that only affect that single profile, with a breakdown similar to the above. You can put aliases there, but they'll only be available when you're logged in as that user. |
Quote:
so, I just put "alias bla=echo bla" or whatever at the end of /etc/profile or...? cool if so. tnx |
aliases
Hi, I not familiar with Ubuntu naming conventions, but in general you will place aliases in the following files.
/etc/profile - if you want system wide access irrespective of the shell being used. /etc/bashrc - if you want to set them specifically for the bash users. /home/user/.bashrc - if you only want that particular account to use the alias ------ The reason that they are dot files in your home directory is to keep them hidden as generally you dont want to see configuration files. Oupa. |
You only need to edit /etc/bash.bashrc or /etc/profile if you want all users to have the aliases. If you only want it for your user you can just add them to ~/.bashrc
or just uncomment the part in ~/.bashrc (about line 50) Code:
#if [ -f ~/.bash_aliases ]; then |
The ~/.profile script is sourced when you login. It could be that you hadn't logged out.
By the way, write an alias like: Code:
alias md='mkdir -p' Quote:
Also, double check whether the profile script sources the .bashrc script. If not, then use the profile script to add aliases. Otherwise, when you login, the alias commands won't be run. |
All times are GMT -5. The time now is 10:02 AM. |