Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Disclaimer: I'm a Windows boy awaiting his first mac. I never bothered learning/using command-line interfaces.

I've been looking at the Terminal Tips and Tricks topic and I don't see how any of those commands would be faster than using the GUI.

For example, someone explained how to search with spotlight, using the terminal. How is this better than just using spotlight?

Could you guys give some real-life examples of situations where you really benefited from your terminal knowledge ?

share|improve this question
add comment

6 Answers

up vote 7 down vote accepted

Aside for development-related purposes, the command line is an excellent tool for automating actions, scripting, and a host of other things that are probably faster than doing them in say, the Finder.

For instance, sometimes I'll be in a folder and want to remove a certain set of files (say, Hello-1.jpg, Hello-2.jpg, Hello-3.jpg, and so on). In the Finder, I'd have to manually select all these files (my Finder is normally set to icon view, so it's a pain to select many files), then move to the trash (granted, I do use the shortcut), and then empty the trash (again, shortcut). For some people, this is convenient enough, but when you get used to using the Terminal, you find that simply typing rm Hello-* is a much faster way to do it.

Of course, this is only one example (a complicated process like moving files to a server or batch resizing photos will gain even more from using the Terminal), but the more you'll look into the topic, the more useful you'll find it. If you're willing to adopt using the Terminal, there's really no reason not to (you'll get slightly less productive in the beginning, but you'll get much better fast).

share|improve this answer
    
thanks, great answer –  Thomas Stock Mar 5 '11 at 8:04
add comment

Many people coming over to Mac OS X come from a Unix-ish environment and prefer terminals, so for them there are command line interfaces to many things. If you prefer to stick with the GUI, no problem.

share|improve this answer
add comment

The command line often has more (and different) options than the GUI tools. Apple's done a good job of giving you the capabilities and tools a normal user needs in the GUI. If you want to do unusual things, it's often missing capabilities you need; for example, I do a lot of sysadmin type work, and often need the additional options that shell commands give.

Here's a specific example: if I need to move someone else's files to a different disk, I want to keep them as the file owner. If I use the Finder, I'm going to wind up owning the copied files; if I use sudo cp -Rp, it preserves ownership and permissions.

Another example: not all preference settings are available in the GUI, but the defaults command can set anything that's stored in the Apple-standard plist format preference file.

Mind you, there are plenty of things that're easy to do in the GUI, but hard/impossible in the terminal. If you want all of the capabilities of OS X available to you, you need to be fluent in both GUI and terminal.

share|improve this answer
add comment

Personally, I don't think using the command line for searching is better than Spotlight. As with most of these, they are personal preferences. One thing I like to do in the Terminal is when I have a large directory of stuff to delete and I just don't want to deal with the two-step Move to Trash and Empty Trash, I will just use the Terminal to rm the files.

As it happens, I am a developer and I end up using the Terminal quite often in that context. But truthfully, you can very easily use a Macintosh without ever opening a Terminal window. A large potion of my extended family is in this group and they do quite a lot with their Macintosh computers.

share|improve this answer
add comment

Some things are just a bit easier to do from the command line. For example, lets say I wanted to find every mp3 on my system, and copy it to /Volumes/MyMP3s unixish way of doing this (works well, takes a while)

find / -name "*.mp3" -exec cp {} /Volumes/MyMP3s \;

Works great. 15 seconds of typing vs. quite some time hunting and clicking.

Why would you want to use spotlight from the command line? It can make operations like the above faster. Since spotlight is using an optimized database (rather than scanning inodes) it will be faster to find the list of mp3s on your system. You can then do something like this (pseudo code, not tested)

foreach file mdfind -name mp3; do
  cp $file /Volumes/MyMP3s
done;

share|improve this answer
    
use '*.mp3' (single quotes) or you can have troubles –  shellholic Mar 5 '11 at 9:40
    
@shellholic correct. –  skarface Mar 5 '11 at 12:53
add comment

For many typical tasks, the command line is merely an alternative for people who prefer typing to pointing and clicking.

Using the command line is also a good way to learn what commands can go into scripts containing long sequences of things to do automatically, which one can then start without having to spend a lot of time repeatedly clicking around for all the individual actions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.