The Terminal: How to make better use of it?

Discussion in 'macOS' started by MacNoobGuy, May 6, 2012.

  1. MacNoobGuy macrumors 6502

    Joined:
    Apr 18, 2012
    #1
    hey guys, i've gotta say i'm really loving the Terminal in OS X. now that's not to say the GUI is terrible, in fact, it's the best GUI i've ever used. i was just wondering if there was a way for me to make use of it more often.

    thanks

    ----------

    i've only just started using it, but is there a way to execute programs within it or check RAM usage, network data flow etc?

    thanks
     
  2. davidlv macrumors 65816

    Joined:
    Apr 5, 2009
    Location:
    Kyoto, Japan
    #2
    Mac OS X Hints has a list of default commands used in the terminal;
    "http://hints.macworld.com/index.php?page=3" and scroll down a bit.
    and if you do a search on that page for "terminal commands" you will find a ton of references.
    If you need information on RAM usage, etc. you can run "top" in the terminal, but most of the time just running Activity Monitor (Applications/Utilities folder) will be more convenient and easier to understand.:cool:
    Asking more specific questions here in this forum (like "How do I turn off the Dashboard using terminal?") will often induce good answers too.
     
  3. MacNoobGuy thread starter macrumors 6502

    Joined:
    Apr 18, 2012
    #3
    ok thanks. what are some more interesting uses the Terminal can be used for?
     
  4. davidlv macrumors 65816

    Joined:
    Apr 5, 2009
    Location:
    Kyoto, Japan
    #4
    That list of default commands I mentioned has many commands used to change the default behavior of the OS, things that sometimes cannot be changed in the System Preferences panels. Onyx and Tinker Tool oftem have these commands incorporated, and they are two of the best (and free too) utilities around.
    Another command, "Purge" will purge all of the once used but inactive RAM, freeing it up for use (actually the inactive memory is supposed to be available to the system when it needs it, but in rare cases that automatic release will not work and you may notice a lack of memory even though you have lots supposedly available. I have never had that situation, but some people say they have. The whole system feels sluggish for a while after using the Purge command, so I cannot say it is a good idea, but it is an interesting example of the use of the terminal.
    Read that list for more examples, such as disabling Dashboard or Spotlight, etc.
     
  5. MacNoobGuy thread starter macrumors 6502

    Joined:
    Apr 18, 2012
    #5
    Most Useful Terminal Commands?

    hey guys, i'm really loving the Terminal as i just bought a Mac a couple weeks ago. i just tried using the 'purge' command and was blown away by how great it worked.

    does anyone have a list of the most useful terminal commands? i couldn't find anything.

    thanks
     
  6. miles01110, May 15, 2012
    Last edited: May 15, 2012

    miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #6
  7. MacNoobGuy thread starter macrumors 6502

    Joined:
    Apr 18, 2012
    #7
    how can i remotely access other PC's with it? can i use Terminal for that?
     
  8. SuperJudge macrumors 6502

    SuperJudge

    Joined:
    Apr 2, 2008
    Location:
    The Triangle, NC
    #8
    You can access other machines with POSIX-based OSes with the ssh command. Syntax would look like this:
    Code:
    ssh username@foobar.com
    There is virtually no limit to what you can do from the command line. Add a package manager like MacPorts or Homebrew and you can add fun stuff like cmus, tmux, byobu, or htop.

    There's also things that require fewer software prereqs like ttytter, a CLI Twitter client and ToDo.txt, a script that lets you keep a simple to-do list.

    If you're serious about using the terminal, start by reading The Linux Documentation Project's Bash Guide for Beginners. That's an excellent place to start since it will give you a more cross-platform view of how the CLI works. Additionally, if you want a book, I heartily recommend The Mac OS X Unix Toolbox. I'm guessing that it might be a little out of date at this point, but the core CLI functionality hasn't changed appreciably since Leopard.

    You'll probably also want to try out using either TotalTerminal or iTerm2 to keep a command line close at hand with a pop-down Quake-style command visor

    But basically, there's not much that you can do from the GUI that you can't do, and probably do better, from the CLI.
     
  9. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #9
    And make sure you have a full complete bootable backup of your Mac in case you do something in terminal that renders the system unbootable. For example, don't make volume wide permissions changes.
     
  10. MacNoobGuy thread starter macrumors 6502

    Joined:
    Apr 18, 2012
    #10
    thanks guys. is there a list of useful commands out there that's similar to 'purge' in how useful and simple they are? or something that displays what the machine is doing right now like the packets in/out?

    thanks
     
  11. MacNoobGuy thread starter macrumors 6502

    Joined:
    Apr 18, 2012
    #11
    i forgot to ask, how do i stop a program from executing? i just did 'ping' and it wouldn't stop until i closed the program.

    how can i check how much data is being sent and received by the Mac from within the terminal?
     
  12. SuperJudge macrumors 6502

    SuperJudge

    Joined:
    Apr 2, 2008
    Location:
    The Triangle, NC
    #12
    Ctrl+C
    You need a program called ifstat, available via MacPorts.

    A list of useful commands? You're probably looking for something like this, but I really recommend the other resources I mentioned in conjunction with a simple list. It will behoove you to understand what commands do and how they interrelate.
     
  13. satcomer macrumors 603

    satcomer

    Joined:
    Feb 19, 2008
    Location:
    The Finger Lakes Region
    #13
    Bookmark the web site MacOSXHints.com. That site's has ten years of many terminal hints/hacks that will get you some cool hints to use Terminal.

    Plus buy a book named Take Control of the Mac Command Line with Terminal. It will help you get started in using the command line.
     

Share This Page