Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

TheBritishBloke

macrumors 68030
Original poster
Jul 21, 2009
2,532
0
United Kingdom
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 :)
 
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.
 
I was wondering if you know any Terminal commands that you use regularly? Or any interesting ones which are great for improving the OS?

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.
 
I like sudo.

sandwich.png
 
I like sudo.

sandwich.png

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
 
I can't tell if you're joking, since you're a woman. :)

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.
 
where's a good place to learn about using Terminal?

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.
 
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.
 
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.
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
tar cf - * | ( cd /target; tar xfp -)

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

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
 
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".
 
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

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. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.