LinuxQuestions.org
Help answer threads with 0 replies.
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 01-02-2008, 08:44 AM   #1
mayaabboud
Member
 
Registered: Oct 2007
Posts: 53

Rep: Reputation: 15
Question 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
 
Old 01-02-2008, 09:24 AM   #2
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,232

Rep: Reputation: 299Reputation: 299Reputation: 299
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.
 
Old 01-02-2008, 09:24 AM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
If you include some aliases in e.g .bashrc, save the file and then:
Quote:
$ . .bashrc
 
Old 01-02-2008, 09:44 AM   #4
mayaabboud
Member
 
Registered: Oct 2007
Posts: 53

Original Poster
Rep: Reputation: 15
i am sorry,


but what does .. bashrc exactly mean?
 
Old 01-02-2008, 09:47 AM   #5
mayaabboud
Member
 
Registered: Oct 2007
Posts: 53

Original Poster
Rep: Reputation: 15
Exclamation 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
 
Old 01-02-2008, 09:51 AM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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.
 
Old 01-02-2008, 09:53 AM   #7
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,232

Rep: Reputation: 299Reputation: 299Reputation: 299
put the this in your .bashrc:

Code:
[[ -f ~/.aliases ]] && . ~/.aliases
the . (dot) command is the same as the 'source' command.
 
Old 01-02-2008, 09:55 AM   #8
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,232

Rep: Reputation: 299Reputation: 299Reputation: 299
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.
 
Old 01-02-2008, 09:58 AM   #9
mayaabboud
Member
 
Registered: Oct 2007
Posts: 53

Original Poster
Rep: Reputation: 15
Lightbulb finally i understand what the dot means , thx

thanks alot for the quick reply

maya
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
wrap lines at 80 for long aliases in .aliases.csh jhwilliams Linux - Software 0 07-26-2007 08:49 AM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 05:29 AM
sendmail and NIS databases (aliases, mail.aliases) - what kind of databases? cotton213 Linux - Software 0 03-14-2006 06:57 PM
Aliases Red Squirrel Linux - Software 2 05-10-2005 07:58 PM
Aliases SkyeFyre Fedora 8 03-18-2005 08:35 PM


All times are GMT -5. The time now is 08:31 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration