How do I start a program from the command line?

Posted:
in macOS edited January 2014
I want to start entourage from the command line (terminal) instead of clicking on the icon. However, I have no idea how to do this. Can someone get me started in the correct direction?



Thanks!



Eric
«1

Comments

  • Reply 1 of 35
    You can do this in Terminal by travelling to the directory where the Entourage.app is stored and then typing open entourage.app.



    If you don't want to have to navigate there each time you can get the path to the program and type open /path/to/entourage.app



    Hope this helps
  • Reply 2 of 35
    aplnubaplnub Posts: 2,605member
    Very much!! So, .app (Mac) are .exe (windows). Thanks!!



    One more question, how do I change directories?



    Eric
  • Reply 3 of 35
    mcqmcq Posts: 1,543member
    cd [directory name]



    For example:

    cd Documents
  • Reply 4 of 35
    keshkesh Posts: 621member
    Keep in mind that you start in your user folder. You'd have to go up two directories, then into Applications. In order to move up a directory, you give the cd command a directory name of ".." (without quotes), like so:



    Code:


    cd ..







    However, you don't have to move to that directory first, as long as you give the proper path to the Open command.



    So, the command you'd want is:



    Code:


    open ../../Applications/Entourage.app







    That basically tells the Open command, "Go up two directories, then into Applications and find the Entourage.app package."
  • Reply 5 of 35
    andersanders Posts: 6,523member
    When did I downgrade to frigging DOS?
  • Reply 6 of 35
    placeboplacebo Posts: 5,767member
    The actual file you'll want to open is the Unix Executable inside the .app package, but Terminal finds that for you anyways, so it's a technicality you won't have to worry about.
  • Reply 7 of 35
    johnqjohnq Posts: 2,763member
    Quote:

    Originally posted by Anders

    When did I downgrade to frigging DOS?



    "Frigging DOS" is merely a copy of frigging unix.





    At least hate unix as unix.
  • Reply 8 of 35
    allanallan Posts: 26member
    Quote:

    Originally posted by Anders

    When did I downgrade to frigging DOS?



    DOS != UNIX Shell
  • Reply 9 of 35
    allanallan Posts: 26member
    Quote:

    Originally posted by johnq

    "Frigging DOS" is merely a copy of frigging unix.





    Only in the sense that a photograph of the Mona Lisa that has been scanned, run through the copier 50 times and then faxed to someone is a copy of the original Mona Lisa.
  • Reply 10 of 35
    aplnubaplnub Posts: 2,605member
    I almost tried dos commands but I thought Unix would be different.



    How do you get a directory? dir doesn't seem to work.



    Thanks!!



    Eric
  • Reply 11 of 35
    rraburrabu Posts: 264member
    Quote:

    Originally posted by aplnub

    I almost tried dos commands but I thought Unix would be different.



    How do you get a directory? dir doesn't seem to work.



    Thanks!!



    Eric




    ls
  • Reply 12 of 35
    ls lists the contents of a directory.



    This may also be of assistance: http://homepage.mac.com/rgriff/files/TerminalBasics.pdf
  • Reply 13 of 35
    Thanks. This is fun. Anyone else have a special trick they like to do in terminal?



    There is only a few things I normally use it for, but I hope to do more now.



    I do "df -h" to check my disk usage and I use "uptime" to see how long, since I restarted.
  • Reply 14 of 35
    gongon Posts: 2,437member
    Quote:

    Originally posted by aplnub

    Very much!! So, .app (Mac) are .exe (windows). Thanks!!





    No they're not. If they were the equivalent of .exe you'd run them by typing their name only, ie. "/Applications/Calculator.app". You use "open /Applications/Calculator.app" because an app is actually a package - a directory in a certain format. The "open" command knows to look inside the package and do the right things to start the app. This is the same thing that happens when you open it in Finder. You can check out the package thing by doing ie. "cd /Applications/Calculator.app". Browse around in there to see the inside of the Calculator.



    To find the real equivalents of .exes, do "ls -F". The entries with an asterisk next to the name (ie. "foobar*") are executables. To run, type the name with path, like "/Users/Me/binaries/foobar". If you are in the same directory, you still need to put in a path. "./" means current directory, so "./foobar" will run that executable. "foobar" won't, because the shell won't try to find files in your current directory. That is a security feature.
  • Reply 15 of 35
    aplnubaplnub Posts: 2,605member
    Thanks! I have made my way into my applications forlder.



    Now, I have a lot of .app files in there but MS Office is different. No .app on the end and I can't get into it.



    When I do "ls" I get a big list in return and this is how MS Office is listed.



    Microsoft Office 2004





    doing a cd / Microsoft Office 2004 doesn't get me in.



    What is special about this folder?



    Eric
  • Reply 16 of 35
    gongon Posts: 2,437member
    Quote:

    Originally posted by aplnub

    Thanks! I have made my way into my applications forlder.



    Now, I have a lot of .app files in there but MS Office is different. No .app on the end and I can't get into it.



    When I do "ls" I get a big list in return and this is how MS Office is listed.



    Microsoft Office 2004



    doing a cd / Microsoft Office 2004 doesn't get me in.



    What is special about this folder?




    Write "cd Micr" or whatever is enough to distinguish it from other folders and press tab to autocomplete the name. It will treat spaces in a name in a special way. When you manually type a name with spaces you need to do the same thing.



    At least I think that is the problem. When you ask a question to a problem like that, include the error messages or even copy-paste a small piece of your inputs and the computer's responses. It'll make it a lot easier to help you.
  • Reply 17 of 35
    aplnubaplnub Posts: 2,605member
    Eric-Bargers-Computer:/applications eric$ cd Microsoft Office 2004

    -bash: cd: Microsoft: No such file or directory

    Eric-Bargers-Computer:/applications eric$



    Using the tab after only a few letters got me this:



    Eric-Bargers-Computer:/applications eric$ cd Microsoft\\

    -bash: cd: Microsoft : No such file or directory

    Eric-Bargers-Computer:/applications eric$





    Still no luck.



    Thanks.



    Eric
  • Reply 18 of 35
    gongon Posts: 2,437member
    It's stopping in the midst of the tab completion because you have another directory with the name "Microsoft ..." in there and it can't know which one you want. After you have pressed tab, and it has filled you the "Microsoft\\ " part, then you type in O for "Office", tab again, and so forth until you got the full name and can press return.



    Alternatively you can just write the name, the same way the tab completion does, ie.:

    cd Microsoft\\ Office\\ 2004



    Yet another way, you can write the filename (folder name) in quotes, and you don't need to "escape" the spaces, like this:

    cd "Microsoft Office 2004"
  • Reply 19 of 35
    aplnubaplnub Posts: 2,605member
    Thanks! That did it! Knowing how it handles spaces is different. I like it.



    Now, how do I terminate Entourage after I get it running?





    Eric
  • Reply 20 of 35
    Quote:

    Originally posted by ibook911

    Thanks. This is fun. Anyone else have a special trick they like to do in terminal?



    There is only a few things I normally use it for, but I hope to do more now.



    I do "df -h" to check my disk usage and I use "uptime" to see how long, since I restarted.




    sudo periodic weekly monthly



    (EDIT) ...er ... somehow i forgot the "daily maintenance task"

    so

    sudo periodic daily weekly monthly



    of course you can run it seperatly



    One more thing: being in terminal, up and/or down arrows

    do browse through your terminal history, - well

    you will see the last actions you have performed

    in terminal.app
Sign In or Register to comment.