LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-02-2008, 07: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, 08:24 AM   #2
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
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, 08:24 AM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
If you include some aliases in e.g .bashrc, save the file and then:
Quote:
$ . .bashrc
 
Old 01-02-2008, 08: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, 08: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, 08: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, 08:53 AM   #7
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

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

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

Rep: Reputation: Disabled
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, 08: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



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

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

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