aliases in bash

Discussion in 'Mac Programming' started by MacFan26, May 15, 2006.

  1. macrumors 65816

    MacFan26

    Joined:
    Jan 8, 2003
    Location:
    San Jose, California
    #1
    hey guys,

    Does anyone have aliases set in their terminal? I've been trying to add one, and it will work in that same window, but not if I open a new window or quit and reopen terminal. Any ideas? I'm just using alias blah="my command"

    thanks :)
     
  2. macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #2
    Where are you setting the alias?

    If it's just in the command line, then the alias is set only for the duration of that terminal session and isn't inherited by any new shells.

    To set aliases and environment variables that are universally accessible, create .bash_profile if it isn't already present and add them to it ... that is, if you're using bash, which you should.
     
  3. thread starter macrumors 65816

    MacFan26

    Joined:
    Jan 8, 2003
    Location:
    San Jose, California
    #3
    Thank you! I knew there was some other file I needed...but I didn't know what it was :eek:
     
  4. macrumors 6502a

    solaris

    Joined:
    Apr 19, 2004
    Location:
    Oslo, Norway
    #4
    Specify your aliases in the .profile file.
    Just like this:
     
  5. macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    chicago
    #5
    i use the single letter k for that. i find it has a nice symmetry with vi.
     
  6. macrumors newbie

    Joined:
    Oct 12, 2008
    #6
    I think it maybe not necessary to create .bash_profile file if U already have .profile in Ur home dir.
     

Share This Page