PDA

View Full Version : aliases in bash




MacFan26
May 15, 2006, 11:59 PM
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 :)



plinden
May 16, 2006, 12:31 AM
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.

MacFan26
May 16, 2006, 02:17 AM
Thank you! I knew there was some other file I needed...but I didn't know what it was :o

solaris
May 17, 2006, 03:43 PM
Specify your aliases in the .profile file.
Just like this:alias ls="ls -G"
alias ..="cd .."

zimv20
May 17, 2006, 10:16 PM
alias ..="cd .."
i use the single letter k for that. i find it has a nice symmetry with vi.

drm12
Oct 12, 2008, 03:21 AM
I think it maybe not necessary to create .bash_profile file if U already have .profile in Ur home dir.