Using aliases in Terminal

Terminal can use aliases for frequently used commands. For example, I have this in my .profile: alias dl='cd Downloads/' to quickly change to my Download folder.


I'm wondering how I can alias the path to a folder and make it usable inside of a shell command. I've added alias dt='Desktop/' to my profile, but when I try to do a command such as "ls dt" (which should list the contents of my Desktop folder), it fails. Any advice on making this work?

15" i5 MacBook 2.4GHz, Mac OS X (10.6.5)

Posted on May 8, 2011 2:50 PM

Reply
18 replies

May 11, 2011 10:13 AM in response to BobHarris

I have to agree with Bob. Unless there is some overriding reason to be using the environment.plist method for setting the environment variables you should just stick with the normal Unix methods.


Though one thing is kool with the plist file. If you run a do shell script "env" command in AppleScript your rc files aren't sourced because the shell spawned for the script isn't a log in shell.


But if you put the environment variables in the plist file they do show up in the shell spawned by the AppleScript. Not earth shaking but nice to know.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using aliases in Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.