Find the answer to your Linux question:
Results 1 to 8 of 8
When I issue 'alias' command it shows me all alias set. But where are these commands actually stored???...
  1. #1
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    where are alias stored

    When I issue 'alias' command it shows me all alias set. But where are these commands actually stored???
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Check the contents of .bash_profile file in your home folder.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    It depends a bit. Any one of these can store aliasses:

    /etc/profile gets sourced during a login session
    ~/.bashrc gets sourced during non-login session
    and ~/.bash_profile always gets sourced
    Can't tell an OS by it's GUI

  4. #4
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    thanks

    but what if I do something like this on my pc
    Code:
    alias c=clear
    on the prompt ,this short cut is available only till the time I work. Where is it stored during that time period???
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  5. #5
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    To make it more clear

    What I did: I changed the home directory of a user with predefined alias( which really make my job easy)

    What happened: In the new directory everything is gone. No alias are present ( which were earlier stored in .bashrc)

    Now what I did:
    Code:
    alias cls=clear
    This code executes perfectly but doesn't work. So if I could know there is it storing the alias temporarily I could fix this problem.
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  6. #6
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by vickey_20 View Post
    but what if I do something like this on my pc
    Code:
    alias c=clear
    on the prompt ,this short cut is available only till the time I work. Where is it stored during that time period???
    In the memory stack associated to the process that's the current shell session. Nowhere else, not in your disk anyway if that's what you meant.

    Quote Originally Posted by vickey_20 View Post
    This code executes perfectly but doesn't work.
    That's what I call a paradox. I guess you mean that the alias sentence gives no error but when you run "cls" nothing happens. Are you sure that the alias was defined correctly? You can use "alias" without arguments to see the current aliases. Check it.

  7. #7
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    Thanks for replying

    The alias command show the cls=clear and now executes perfectly fine. But when I change the the shell to csh and give
    Code:
    alias cls=clear
    again it executes without any error. But this time in the csh shell on issuing the alias command I can't see the cls=clear which I earlier saw in bash shell
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  8. #8
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Aliases are a functionality from your shell. So, check the csh man page. I know nothing about csh at all. The syntax might be different than this of bash.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...