Interesting Terminal Commands?

Discussion in 'macOS' started by TheBritishBloke, Jan 19, 2010.

  1. TheBritishBloke macrumors 68030

    TheBritishBloke

    Joined:
    Jul 21, 2009
    Location:
    United Kingdom
    #1
    Hey guys,

    I was wondering if you know any Terminal commands that you use regularly? Or any interesting ones which are great for improving the OS?

    Thanks :)
     
  2. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #2
    Check out a unix in a nutshell or unix power tools from O'Reilly they have some very useful information on how to leverage the power of unix on OSX.
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
  4. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #4
    Terminal commands don't improve the OS, they just offer a different way of manipulating it which, after practice, becomes much more convenient and powerful than using Finder. Just google "common terminal commands" and those are the ones everyone uses.

    Also, if you don't know what you're doing... don't mess around with Terminal.
     
  5. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #5
    +1 on that! If you don't know what you are doing you can easily wind up with an unbootable Mac. When I worked in Unix, there were often times when new people would make an awful mess fooling around with commands.
     
  6. Jisuo macrumors 6502

    Joined:
    Dec 4, 2008
    Location:
    Sweden
  7. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #7
    sudo is one of the worst commands to fool around with.
     
  8. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #8
    Technically it's not a command. Typing "sudo" won't do anything by itself other than bringing up the usage dialogue.
     
  9. -aggie- macrumors P6

    -aggie-

    Joined:
    Jun 19, 2009
    Location:
    Where bunnies are welcome.
    #9
    I can't tell if you're joking, since you're a woman. :)

    I use rm alot.
     
  10. windels macrumors regular

    windels

    Joined:
    Oct 12, 2008
    Location:
    Belgium
    #10
    killall Finder, to reboot the finder. came in handy a few times.
     
  11. prostuff1 macrumors 65816

    prostuff1

    Joined:
    Jul 29, 2005
    Location:
    Don't step into the kawoosh...
    #11
    I tried that on my sister once...

    She told me to make my own damn sandwich. So it does not quite work like that all the time.

    Though, I was surprised that she understood what sudo was. It’s a heart warming feeling knowing that she has paid some attention to the geek stuff have been talking to her about. It makes me almost proud to call her my sister... :p
     
  12. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #12
    Who's a woman? Or are you referring to yourself? I'm certainly not one.

    The man command is great because it lets you learn about a command so you don't fubar yourself.
     
  13. marcre macrumors regular

    marcre

    Joined:
    Jan 15, 2008
    Location:
    East coast
    #13
    where's a good place to learn about using Terminal?
     
  14. marcre macrumors regular

    marcre

    Joined:
    Jan 15, 2008
    Location:
    East coast
  15. mslide macrumors 6502a

    Joined:
    Sep 17, 2007
    #16
    Any beginner unix book or website. It will be easier to follow if you find one that uses the bash shell in their examples as opposed to something like csh. Just make sure you fully understand any command before executing them.
     
  16. enberg macrumors regular

    Joined:
    Jan 13, 2010
    #17
    Learning how to use "mv" and "cp" with filename globbing is probably the most useful thing to start with. Often a hell of a lot faster than moving stuff in Finder.
     
  17. r0k macrumors 68040

    r0k

    Joined:
    Mar 3, 2008
    Location:
    Detroit
    #18
    Some things are better suited to the terminal but many are best suited to the gui. For instance, to copy a folder containing thousands of files you can type right click it, pick copy, browse to the destination and click paste or you can type the following in terminal:

    tar cf - * | ( cd /target; tar xfp -)

    I don't know about you, but I prefer the gui for this.

    I tend to use the terminal mostly for operating on "headless" linux servers. For instance, I have an old pc lying around inflicted with some flavor of windows. I pop in a Linux live distro, let it install, pick a static ip, then take my monitor and keyboard back to the machine I borrowed them from. Any future interaction with that machine is done remotely through a terminal.

    There are times in OS X that I would rather use the terminal than the gui, but they are rare. If you are asking about "interesting terminal commands" to learn about doing things "better" in terminal than through the gui, I think you might be on the wrong track. If somebody is telling you the terminal is the "Manly Way" to use your Mac, they are a fossil throwback to the "Order of the Priesthood of the Sacred Machine" from some time back in the 1960's when only "Real Men" used computers and only spoke to them in ebcidic. People who claim the terminal is superior are victims of outmoded thinking. There is nothing superior about memorizing sed|awk|grep commands versus learning your way around system preferences. However, knowing your way around terminal gives you a lot more flexibility and promises to increase your knowledge of the inner workings of Unix in general and OS X in particular.

    If you want to learn about Unix, the terminal provides an excellent opportunity to do so. Anything really dangerous will require sudo so as long as you avoid sudo during your learning process, go ahead and have fun. My favorite Unix book is from ORielly, Unix in a Nutshell. It's arguably the only book you ever need. Those 700 page "bibles" contain a lot of fluff. The only down side for Linux users is "Nutshell" still talks about redhat package manager and doesn't cover some of the newer methods of keeping packages up to date. However, this is no big deal on OS X because SoftwareUpdate takes care of that for us.
     
  18. mslide macrumors 6502a

    Joined:
    Sep 17, 2007
    #19
    It's all about what one is more suited to. For me, using a mouse = slow. I can work much faster if I do things like the above just on the command line.

    BTW, any particular reason why you would tar up the files, copy them over, and then untar them as opposed to just doing:

    Code:
    $ cp -R src_folder_name dst_folder_name
     
  19. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #20
    If you want to muck about in the terminal and learn stuff, proceed from a non-admin account (create one if you have to). That makes it much more difficult to trash your system. There was a panic thread around here somewhere from someone who had foolishly entered "sudo rm -rf /private".
     
  20. r0k macrumors 68040

    r0k

    Joined:
    Mar 3, 2008
    Location:
    Detroit
    #21
    Tar tries to preserve times, dates, permissions, etc. There are times when cp creates files where there were once links or loses track of sticky bits on directories, etc. And no, I do not prefer tar. I prefer the gui for this particular task. I offered tar as an example of overkill for something that is two clicks in the gui.

    I agree that faster is better. If looking up the command is taken into account, the gui is faster for many users, including many of my day to day tasks. If the command is fresh in my memory, I find terminal can be a lot faster, especially when up arrow lets me pick from recent commands. :)
     
  21. Theclamshell macrumors 68030

    Joined:
    Mar 2, 2009
    #22
    Go into an apple store, open terminal and type yes
     

Share This Page