Command line for average users?

Discussion in 'macOS' started by theman5725, Aug 28, 2006.

  1. theman5725 macrumors 6502

    Joined:
    Aug 2, 2006
    #1
    I always read stuff about how terminal and command line interfaces are so powerful, but what exactly can they do so good? Is there any point to using Terminal if you are just an average user? I've just been wondering this.
     
  2. EricNau Moderator emeritus

    EricNau

    Joined:
    Apr 27, 2005
    Location:
    San Francisco, CA
    #2
    Just an average user? No.

    However, for the more experienced user, it can be a very valuable tool.
     
  3. jsw Moderator emeritus

    jsw

    Joined:
    Mar 16, 2004
    Location:
    Andover, MA
    #3
    I agree that an average user has little need for Terminal and probably would be fine if it were deleted from their Mac.

    However, it's indispensable to me. I use it for development, for getting to files Finder won't show me, for Unix command-line tools, etc. I can make aliases that are real ones (as opposed to the almost useless ones Finder makes). I can search for files and things in files better than Spotlight allows.

    There are ways in Finder to do many of the things Terminal can do, but Terminal does most of them better.
     
  4. twoodcc macrumors P6

    twoodcc

    Joined:
    Feb 3, 2005
    Location:
    Right side of wrong
    #4
    what was that command that told you the last uptimes that you had and whether the computer crashed or was shutdown? i think it did like the last 15 shutdowns.

    thanks in advance
     
  5. twoodcc macrumors P6

    twoodcc

    Joined:
    Feb 3, 2005
    Location:
    Right side of wrong
    #5
    come on, i know somebody knows that command.

    i know it has a "|" in it, and "last"

    but that's all i can remember
     
  6. baummer macrumors 6502a

    Joined:
    Jan 18, 2005
    Location:
    Southern California
    #6
    Open a new Terminal window

    type last and press enter
     
  7. savar macrumors 68000

    savar

    Joined:
    Jun 6, 2003
    Location:
    District of Columbia
    #7
    For an average user, probably not.

    The terminal is really useful for a few kinds of cases:
    1) Accessing a computer remotely. If you have to access a computer over the internet, using a command line is much faster than using Remote Desktop or one of those technologies.
    2) Doing ad-hoc data processing. A lot of times I find myself needing to do some obscure operations to manipulate text files. It is very convenient to do things like global search and replace, merge files, sort, etc. from the command line in a single command (actually multiple commands piped together).
    3) Performing low-level tasks. You can see processes from the command line that are not visible in the Dock. You can suspend or quit these processes much more effectively than you can with cmd-opt-esc. You can also delete files that are not easily deleted by finder.

    I'm sure other people find lots of uses for it, but I think most people who do like command lines are developers.
     
  8. twoodcc macrumors P6

    twoodcc

    Joined:
    Feb 3, 2005
    Location:
    Right side of wrong
    #8
    hey, that did work. but it's not quite the same though.*

    anyways, what does "console" mean?

    thanks
     
  9. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #9
    What's the command for making aliases in terminal? it sounds like it might come in useful. :)
     
  10. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #10
    Something more like last | grep "shutdown" perhaps?
     
  11. ChrisBrightwell macrumors 68020

    ChrisBrightwell

    Joined:
    Apr 5, 2004
    Location:
    Huntsville, AL
    #11
    ln
     
  12. khammack macrumors regular

    Joined:
    Sep 28, 2004
    Location:
    Portland, OR
    #12
    Well if you really want to learn a few tricks:

    http://linuxcommand.org/

    It's specifically for linux, but much of it applies to OS X as well (since they are both derived from unix).

    -kev
     
  13. apfhex macrumors 68030

    apfhex

    Joined:
    Aug 8, 2006
    Location:
    Northern California
    #13
    Activity Monitor.app is equally as useful for this particular thing though. I guess it's a matter of preference (I'm not a CLI junkie, I like to use GUIs when available).

    If you, meaning the "average user", doesn't know what use the Terminal is, then chances are you don't need it.
     
  14. iJawn108 macrumors 65816

    iJawn108

    Joined:
    Apr 15, 2006
    #14
    Netstat is pretty handy(IMO)

    SYNTAX

    netstat [-a] [-n] [-v]

    netstat [-g | -m | -p | -s | -f address_family ] [-n] [-P protocol]

    netstat [ -i ] [ -I interface ] [ interval ]

    netstat -r [-a] [-n] [-v ]

    netstat -M [-n] [-s ]

    netstat -D [ -I interface ]

    -a Show the state of all sockets and all routing table entries; normally, sockets used by server processes are not shown and only interface, host, network, and default routes are shown.
    -n Show network addresses as numbers. netstat normally displays addresses as symbols. This option may be used with any of the display formats.
    -v Verbose. Show additional information for the sockets and the routing table.
    -g Show the multicast group memberships for all interfaces.
    -m Show the STREAMS statistics.
    -p Show the address resolution (ARP) tables.
    -s Show per-protocol statistics. When used with the -M option, show multicast routing statistics instead.
    -i Show the state of the interfaces that are used for TCP/IP traffic.
    -r Show the routing tables.
    -M Show the multicast routing tables. When used with the -s option, show multicast routing statistics instead.
    -d Show the state of all interfaces that are under Dynamic Host Configuration Protocol (DHCP) control.
    -D Show the status of DHCP configured interfaces.
    -f address_family imit statistics or address control block reports to those of the specified address_family, which can be one of:
    inet For the AF_INET address family
    unix For the AF_UNIX address family

    -P protocol Limit display of statistics or state of all sockets to those applicable to protocol.
    - I interface Show the state of a particular interface. interface can be any valid interface such as ie0 or
    le0.
     
  15. relimw macrumors 6502a

    Joined:
    May 6, 2004
    Location:
    SC
    #15
    'top' is useful too. For instance from my G4 mini right now:

    Code:
    Processes:  58 total, 3 running, 55 sleeping... 178 threads            21:03:15
    Load Avg:  1.52, 1.55, 1.52     CPU usage:  91.1% user, 8.9% sys, 0.0% idle
    SharedLibs: num =  195, resident = 43.2M code, 4.82M data, 7.46M LinkEdit
    MemRegions: num =  7606, resident =  240M + 11.1M private,  104M shared
    PhysMem:  88.7M wired,  241M active,  647M inactive,  978M used, 46.0M free
    VM: 4.34G +  131M   49801(0) pageins, 200(0) pageouts
    
      PID COMMAND      %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  VSIZE
      784 top          7.8%  0:01.10   1    18    22   704K   408K  1.12M  26.9M 
      780 mdimport     0.0%  0:00.55   4    62    55  1.03M  4.57M  3.24M  40.3M
      587 seamonkey-  13.6%  2:16:13  10   168  1067   147M- 42.0M   149M   561M 
      554 bash         0.0%  0:00.08   1    14    17   232K   856K   892K  27.2M
      553 login        0.0%  0:00.01   1    16    36   140K   424K   552K  26.9M
      514 Terminal     0.7%  0:47.52   5   156   199  3.21M  11.8M  8.98M   128M
      510 Keynote      0.4%  5:55.22   4   108   358  15.1M  31.0M  44.2M   171M
      285 AppleSpell   0.0%  0:00.16   1    34    36   716K  2.33M  1.86M  37.7M
     
  16. theman5725 thread starter macrumors 6502

    Joined:
    Aug 2, 2006
    #16
    Not exactly the average user, more like somebody who isnt a delevoper/programmer. I always thought command lines were for things like that.
     
  17. twoodcc macrumors P6

    twoodcc

    Joined:
    Feb 3, 2005
    Location:
    Right side of wrong
    #17
    well that's closer, but not quite it.

    so i know it has: last, |, grep

    but i can't remember what else or in what order
     
  18. hayduke macrumors 65816

    hayduke

    Joined:
    Mar 8, 2005
    Location:
    is a state of mind.
    #18
    I guess the Terminal might not be useful for "average" (or below-average ;)) users, but here are some simple examples of things you can do:

    1) If you have a folder of mixed filetypes (*.jpg, *.doc, *.txt, etc.) you can easily move all of the *.jpg files into a new folder. This might be a pain to do with the mouse.

    2) If you want to move a file (or group of files) from one folder to another that is deeply buried you can do this pretty easily within the terminal. Admittedly, this isn't too tough in the Finder either.

    3) I use it frequently to sftp or scp files from one computer to another. Presumably, at some point, Apple will finally introduce proper FTP navigation in the Finder (sheesh!).

    4) You can also do things like download a lot of images of a webpage. The curl function lets you grab all of the *.jpgs on a webpage, which is handy if your family just posted the latest vacation pics and you want a copy of all of them.

    5) I also use it a lot for programming, but this is probably not considered an "average" use.

    6) I find the grep function really useful for finding tid-bits of text within a directory containing lots of text files. For example, if I had a bunch of family letters I could "grep" for "Las Vegas" to find any documents that contain the term "Las Vegas." You can basically do this with spotlight now, but I still haven't fully adapted to using Spotlight.

    Those are just a few things off the top of my head.
     
  19. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #19
    I guess next time you'll save something important as a script. :)
     
  20. twoodcc macrumors P6

    twoodcc

    Joined:
    Feb 3, 2005
    Location:
    Right side of wrong
    #20
    i guess so. thanks for trying though
     
  21. whooleytoo macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #21
    This has always been possible by sorting by kind, and it's even easier now with Spotlight in the Finder.
     
  22. Josh macrumors 68000

    Josh

    Joined:
    Mar 4, 2004
    Location:
    State College, PA
    #22
    You can use FTP via the terminal to upload/download files to a webserver without downloading and/or paying for an application that does it.

    You can also use SSH to log on to other computers and run commands (but if you needed to do this, this is probably something you'd already know).

    Compiling and writing programs is another.

    The terminal is mostly for geeks and nerds.

    Mom and pop don't have much use for it at all :)
     
  23. whooleytoo macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #23
    The terminal is very useful for automating repetitive tasks. You can do so to a similar extent with Applescript, but in my experience it's not as pervasive and not much easier either.
     
  24. acidity macrumors regular

    Joined:
    Sep 7, 2006
    #24
    OK.

    What is the keyboard shortcut to start a terminal windows in Mac OS X? I am a keyboard guy and dosnt like to mouse click everytime terminal to open a terminal. Is this possible in Mac or we have to do some extra key bindind...if yes then how :)
     
  25. whooleytoo macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #25
    If using 10.4, Spotlight might be the easiest way to go.

    Command-Space to start searching, type "Term", then hit Command-Return to launch it. In practice, it doesn't take much longer than a single keystroke, with the benefit you don't have to manually create a binding for every such app.
     

Share This Page