LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   scripting/aliases (https://www.linuxquestions.org/questions/linux-newbie-8/scripting-aliases-610575/)

mayaabboud 01-02-2008 07:44 AM

scripting/aliases
 
hellow everyone,

does any1 know how to use aliases without having to log out and log in again?

thanks alot in advance
and happy new year by the way
maya

dive 01-02-2008 08:24 AM

If I get your meaning you are putting aliases in .bashrc .bash_profile or some other file and having to log out and in again to use them?

What I do is put my aliases in .aliases which gets sourced from my .bashrc file:

Code:

. ~/.aliases
Then if I make a new alias I just source the .aliases file from a console using the same command.

sycamorex 01-02-2008 08:24 AM

If you include some aliases in e.g .bashrc, save the file and then:
Quote:

$ . .bashrc

mayaabboud 01-02-2008 08:44 AM

i am sorry,


but what does .. bashrc exactly mean?

mayaabboud 01-02-2008 08:47 AM

acripting/aliases
 
so from what i understand :

i should create a .aliases file

but how to "source it" from my .bashrc file ?

thx again
maya

Nylex 01-02-2008 08:51 AM

Put ". ~/.aliases" in your .bashrc file, like dive said.

". .bashrc" means to source the .bashrc file. You can also run "source .bashrc".

FWIW, I put my aliases in my .bashrc file.

dive 01-02-2008 08:53 AM

put the this in your .bashrc:

Code:

[[ -f ~/.aliases ]] && . ~/.aliases
the . (dot) command is the same as the 'source' command.

dive 01-02-2008 08:55 AM

I used to put aliases directly in my .bashrc but I have so many now that I use a separate file. Plus it is easier to source the file from the console if I add any new ones.

mayaabboud 01-02-2008 08:58 AM

finally i understand what the dot means , thx
 
thanks alot for the quick reply

maya


All times are GMT -5. The time now is 03:50 AM.