You can define any number of shortcuts (aliases) to start up applications. For example, to start up TextEdit from the command line and open a file, all you need to do is type:
te main.C &
where: te is the alias you specify, main.C is the name of the text file that you want to edit, and & backgrounds the process (which means you can continue working in the command line).
To learn how to set this up and add to your UNIX knowledge, read the rest of the article ... and thanks to 'anonymous' for sending this in!
To set this up, do the following:
1) Create the following directory: ~/Library/init/tcsh
ie in your home directory, go to the Library folder and create an "init" folder (if it's not there already), then create a "tcsh" folder inside the "init" folder.
2) Create a text file called "aliases.mine" inside the tcsh folder (if you do this using TextEdit, make sure you select "Make Plain Text..." option).
3) Add the following line to this file:
alias te '/Applications/TextEdit.app/Contents/MacOS/TextEdit'
Note, when generating alias names, make sure that a command doesn't exist first. Eg, I couldn't use the name "tee" because there is a program called that already (type "man tee" to find out more about it).
4) Save the file (path should read "~/Library/init/tcsh/aliases.mine").
5) Open a new Terminal window and type "alias". You should see your "te" entry in amongst other entries (they are essentially command-line shortcuts).
6) Try it out... simply type te
and that should start TextEdit. You'll notice that you cannot use your Terminal window until you quit TextEdit. To avoid that from happening, just type
te &
which will open TextEdit in the background (which means you can use the Terminal while TextEdit is running). To open a file as well, just type in the filename after "te" and before '&', like
te foo.txt &
If you want to get really tricky, you can open multiple files in one go! Navigate to a directory with mulitple files (lets say they are all rtf's and have the ".rtf" extensions) and enter:
te *rtf &
this will open TextEdit with a window for each file.
Getting Dirty! If you really want to be even more tricky, you will find the single character regex handy. Say you're a programmer (as we all are :) and you have the following files:
myApp.C
myApp.h
to open them in one go, just type:
te myApp.[Ch] & or te *.[Ch] &
to open all files that end with either a 'C' OR 'h'.
Note: Each time you issue a "te" command, this will open a new copy of TextEdit. Do this a few times without quitting TextEdit, and you'll find multiple copies open!
What else can I have in my aliases.mine file? Anything you want... here's an abridged version of my aliases.mine file (note, anything after the '#' character is ignored):
##
# TCSH Expanded C-Shell INITIALIZATION FILE
# Aliases file
#
# Wilfredo Sanchez Jr. | tritan@mit.edu
# June 10, 1994
#
# MIT Project Athena
##
alias l 'ls -g --color'
alias lk 'ls -ga --color'
alias ll 'ls -lg --color'
alias llk 'ls -lag --color !* | more'
alias hack 'cd ~/documents/hack'
alias rascal 'telnet 192.168.0.1'
alias te '/Applications/TextEdit.app/Contents/MacOS/TextEdit'

