10 Replies Latest reply: May 14, 2012 9:16 PM by softwater
Rasuul Level 1 Level 1 (0 points)

I'd like to learn how to transcend the limitations of my Mac's present functionality and my impression is that, ultimiately, the best way to do so is to learn to use the command line and write scripts from there.

 

Does anyone know of a great intro to the command line / online forum equivalent to the outstanding Tex stack exchange? I'd really like to enjoy the process insofar as possible, so a structured intro would be greatly appreciated!

 

Kind regards,

 

 

Rax Adaam


MacBook Air, Mac OS X (10.6.7), Mem: 2GB 1067 MHz DDR3 (sigh)
  • 1. Re: Learning terminal - suggested reference / community guide?
    Rasuul Level 1 Level 1 (0 points)

    Any suggestions whatsoever? Really anything would be apprecaited: good forum for getting started - videos that you've seen; online course - ?

     

    Thanks in advance,

     

    Rax

  • 2. Re: Learning terminal - suggested reference / community guide?
    BobHarris Level 6 Level 6 (13,110 points)

    Learning the command line teaches you Unix, it doesn't really teach you about Mac OS X.

     

    There are other posts about learning the command line.  You should even be able to see some on the right hand side of the web forum.  And you can search for Terminal and most likely find similar posts.  There have been pointers to online Mac OS X Terminal command tutorials.

     

    Go to a bookstore and browse just about any book on Unix/Linux command lines stuff.  Especially books on "Bash" (the default Mac OS X shell), and other books on Unix/Linux scripting.  While not everything will be the same, 80% of what these books talk will apply to Mac OS X.

     

    You can find useful posts at MacOSXHints.com which frequently has posts about doing things via the Unix side of Mac OS X.

     

    Finally the Terminal is nothing, it is just a bit of software that displays the output from the shell, and programs run by the shell, and passing input from the keyboard to the shell and programs run by the shell.  Besides that the Terminal doesn't really have any significant power.

     

    Use the "man" command to find out information about various commands ("man man").  Use "apropos" to find possible commands that will do what you want ("man apropos").

     

    Most of the commands that the bash shell will execute will be found in /bin, /usr/bin, /sbin, /usr/sbin, and /usr/X11/bin.  If you have installed XCode developer tools, you will find more commands in /Developer/usr/bin, /Developer/usr/sbin, /Developer/Tools.  Additional progarm may be found in other locations, as a command is just an executable program, or executable shell script, or a built-in command within the shell (bash).

  • 3. Re: Learning terminal - suggested reference / community guide?
    baltwo Level 9 Level 9 (60,115 points)

    You might want to reconsider the Xcode paths with the advent of the new app only Xcode which buries Developer inside itself.

  • 4. Re: Learning terminal - suggested reference / community guide?
    Rasuul Level 1 Level 1 (0 points)

    Thank BobHarris - I'm aware of some of those distinctions, although it is hugely helpful to have them summerised in that form. The suggestions are very much appreciated. And just so you don't think I hadn't searched the site: all the other posts were from several years ago (~5+) & I wondered if the resources weren't a bit dated - being for technology and all. I know not much has probably changed re: basics of the command line, but I thought in terms of resources for learning it, maybe there had been some developments. Thank you!!

  • 5. Re: Learning terminal - suggested reference / community guide?
    Rasuul Level 1 Level 1 (0 points)

    @baltwo what do you mean by xcode "buries developer inside itself"? I thought xcode was more limited in what it enabled one to do than working from the command line ... I apologize if I'm comparing apples with oranges here.

     

    Best,

     

    Rax

  • 6. Re: Learning terminal - suggested reference / community guide?
    softwater Level 5 Level 5 (5,370 points)

    I couldn't disagree more with the above posters. Learning 'the Terminal' (in this case, that means Bash) is NOT 'learning Unix'. That's a common misconception. The shell and the operating system are entirely different things.

     

    Learning the shell and how it interacts between the GUI and the operating system is immensely powerful way to learn how to take control of your Mac, or any other Unix based machine.

     

    There are three books for learning Terminal; best to read them concurrently

     

    Learning the Bash Shell

     

    Bash Cookbook

     

    Classic Shell Scripting

     

    Apple also have a free tutorial here:

     

    Shell Scripting Primer

     

    However, I'd recommend going through the first three books first. It'll make a lot more sense.

  • 7. Re: Learning terminal - suggested reference / community guide?
    JoeyR Level 6 Level 6 (8,275 points)

    Just a quick caveat (and you may already be aware of this)... Using the terminal will allow you to bypass pretty much all of the security and protections built into OS X (especially if you start messing around as root).  You should be sure to have a backup before trying things out (although, you should always have a backup).  It's also a good idea to have a second installation (on an external drive or separate partition) to experiment on.  This way if you do something that you can't undo, you won't have to reinstall your OS to get things up and running again.

  • 8. Re: Learning terminal - suggested reference / community guide?
    Rasuul Level 1 Level 1 (0 points)

    @softwater thank you so much. I really appreciate the concrete suggestions - that's exactly what I was looking for. Thank you for taking the time to share your thoughts on the matter.

     

    @JoeyR Thanks for the sage advice. I dare say it sounds like liessons learnt from personal experience! Is it sufficient to set up a separate user or is an installation on a separate drive strictly necessary?

     

    Thanks again!

     

    Best,

     

     

    Rax

  • 9. Re: Learning terminal - suggested reference / community guide?
    X423424X Level 6 Level 6 (14,190 points)

    The best book I recommend (or add a vote for since it was mentioned above) is O'Reilly's Learning The Bash Shell (3rd edition).

     

    Also keep the actual bash reference manual handy.

  • 10. Re: Learning terminal - suggested reference / community guide?
    softwater Level 5 Level 5 (5,370 points)

    You're welcome, and enjoy. Discovering Bash is fun. While Joey's right, I wouldn't worry about it so much if you follow the books I recommended earlier as they're won't lead you into anything dangerous till you're ready for it.

     

    In any case, always keep a daily clone backup of your entire system and no harm will come to you or your mac!