Dan, In order to start Safari from the command line in terminal you could use the "open" command followed by the URL you wanted to open (with the "http://" preface included); for example:
open http://www.apple.com You can use the "open" command in terminal's command line to open either files or web sites (which is why you need to put the "http://" at the beginning of the URL -- if you leave this prefix off, you'll be told that there's no file "www.apple.com" in your directory, and perhaps you meant "http://www.apple.com"). So: open comments.txt would open your file named comments.txt in TextEdit, etc. More generally, you can specify an application to use for opening a file: open -a Pages comments.txt would open the "comments.txt" file in Pages instead of TextEdit. If, for some reason, you wanted to open your web page in a different browser, such as WebKit, you could give the command: open -a WebKit http://www.apple.com and the page would open using WebKit instead of Safari. (You don't need to specify the application if you're opening the file with its default application.) Incidentally, although I type the application names with upper and lower case letters, terminal is case insensitive, and doesn't care whether you capitalize Safari, WebKit, or TextEdit. To find out about more command options, use the "man" command in terminal to display the unix manual pages for the command. An excellent introduction to the command line for the Mac can be found in the Take Control book series: "Take Control of the Mac Command Line with Terminal" by Joe Kissell. This series of books is sold as downloadable PDF files, at relatively modest costs, and updated minor version updates are free downloads: http://www.takecontrolbooks.com/command-line I posted earlier that their "Take Control of VMWare Fusion 3" was offered as a free download, since VMWare is sponsoring this distribution: http://www.takecontrolbooks.com/vmware-fusion-3 On page 4 of that book, there is a coupon for 50% discount on your next "Take Control Books" order, so you could download the free book on VMWare Fusion 3, then use the coupon code or link in that book to place your order for any other Take Control Books at half price (which would be $5 for the "Take Control of the Mac Command Line with Terminal" book). Apart from the information about command line features, the book gives interesting alternative ways to more easily view man page information, including checking web sites like using the online link at: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/ Another suggestion, which I like, is to add a definition which automatically sets the man page output to a format that can be displayed and read in Preview, which is much easier to use, especially for man pages that are very long. This uses the option to output man pages in PostScript format, which will automatically display in Preview. Based on the "Take Control of the Mac Command Line with Terminal": 1. Open a TextEdit window and paste in the four following lines: psman() { man -t "${1}" | open -f -a /Applications/Preview.app/ } 2. Use Command-Shift-S (the "Save As" option in the File menu) to save the file as: .bash_profile You need to type or paste this in exactly, with the leading period, into the "Save As" text field of the dialog window. 3. Press Command-Shift-H to ensure that this file is saved to your (top level) home directory. 4. Navigate (VO-Right arrow) to the check box for "If no extension is provided, use ."txt"", and make sure this box is unchecked (using VO- Space). 5. Navigate (VO-Right arrow) to the "Save" button and press it (VO- Space). 6. You'll get a dialog window warning you that names that begin with a dot are reserved for the system and that if you go ahead with this the file will be hidden. Navigate (VO-Right arrow) to the button for Use "." and press it (VO-Space). (This is a system file). 7. Now when you open a terminal window and type in "psman" instead of "man" for a command, the results will automatically be displayed in Preview. For example: psman open will show you the options for the "open" command. Note that this will only work for terminal windows opened after you created the .bash_profile file in your home directory. If you had a terminal window open when you created the file and try to use the psman command, it will not be recognized. Finally, if you already have a .bash_profile file, then you want to add the definition for psman to that file instead of creating a new .bash_profile file. However, if you are using a .bash_profile file you should be knowledgeable enough to realize this. HTH Cheers, Esther On Nov 28, 2009, .dan. wrote: > > I'm very interested to do many things from the commandline in > terminal. > From time to time we hear of some application that comes with a > commandline > interface along with the gui. Vlc is a current example. At the > commandline one would type: > > vlc filename > > to play the named file. > > Are there others known to users? > > I know regular mac applications can be started from the command > line, or a > second example if one is already active. > > Does anyone know how one might point to a file to act upon at > startup like > in the vlc example? > > For example: > > safari urlname > > Would start safari and go to the named url. > > > XB > IC|XC > > -- > > You received this message because you are subscribed to the Google > Groups "MacVisionaries" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected] > . > For more options, visit this group at > http://groups.google.com/group/macvisionaries?hl=en > . > > -- You received this message because you are subscribed to the Google Groups "MacVisionaries" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/macvisionaries?hl=en.
