.bashrc,.aliases

I have a question for aliases.
Under my local home profile I see .aliases and .bashrc

1 If I need to update .aliases should I also update .bashrc as well? I see entried which exist in .aliases also in .bashrc
2) Should I exit and login to my home profile each time I make any update to .aliases/.bashrc
pal2kAsked:
Who is Participating?
 
larry urbanConnect With a Mentor DevOps EngineerCommented:
1) .aliases is usually called by .bascrc; you should not put updates in them both, just one or the other. If you .bashrc is not referencing your .aliases then make sure to just do your updated to the .bashrc.

2) not really, you should only have to open a command line window a few times if it is an update just for command line options. If it is an update that would affect your profile in  more global sense, then a re-login is required.
0
 
larry urbanDevOps EngineerCommented:
1) .aliases is usually called by .bascrc; you should not put updates in them both, just one or the other. If you .bashrc is not referencing your .aliases then make sure to just do your updated to the .bashrc.

2) not really, you should only have to open a command line window a few times if it is an update just for command line options. If it is an update that would affect your profile in  more global sense, then a re-login is required.
0
 
pal2kAuthor Commented:
I see that .bashrc is calling .aliases
But If I don't exit and re-login I dont see changes in aliases update?
I also see that what ever in .aliases also exist in .bashrc? why is that? when I tried to just update only the .aliases after re-login it works.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
larry urbanDevOps EngineerCommented:
the purpose of .aliases is for command line shortcuts like setting ls to be equal to a ll -a. it is just to separate code snippet types.

Seeing the changes depends on what they are, usually in my experience, if I add an alias in the .alieses or .bashrc I have to open 5 new window before I see the changes (using Mandrake in my case) on other distros may be different too.
I'm not sure why you would see code in both, it may be that .aliases is being used also by other scripts, so they were added there too.
0
 
simon3270Commented:
Having the same alias in two places, particularly if one script calls the other, is a bad idea - if you change one you have to remember to change both, to be sure that your new version is used and to avoid later confusion.  I would have them only in .aliases.

You don't need to log in again - just:
cd
. .aliases

Open in new window

to re-read your aliases.  This will overwrite any changed ones and create new ones, but any you have deleted from .aliases will still be there, until you log out and in again.  Remember that this has to be a complete logout - if you have a graphical display you need to log out of that, not just close one of the terminal windows on that graphical screen.
0
 
pal2kAuthor Commented:
I meant 2 places is .aliases and .bashrc. But what Todar said make sense. I guess .aliases might be used by other scripts. Anyways....thanks guys
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.