Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Learning Unix for Mac OS X Panther

timothy posted more than 9 years ago | from the why-discriminate dept.

Books 337

sympleko (Matthew Leingang) writes "In Neal Stephenson's manifesto In the Beginning was the Command Line , he writes about his favorite command-line utility: wc. As simple as can be, wc counts characters, words, and lines in a file. There's no GUI analogue, perhaps because anybody tempted to make one would add too many "features" that cluttered its ease of use. Think: do you know how to count the words in a Word file? BBEdit is a little easier, if you know the button to click." Read on for Leingang's review of Learning Unix for Mac OS X Panther, which seeks to reconcile the conception of user friendliness in OS X's Aqua with the sometimes-denigrated command line.

You can do a tremendous amount of stuff in Mac OS X Panther without ever touching the command line. This includes editing files, transferring them to remote locations, running a web server, and writing programs. Legend has it that some Apple developers wanted to ship OS X without a command-line application because it's anathema to the Mac "experience." But as Unix geeks will tell you, there are tasks which are much better suited to the command line. Routine, repeated, and automated tasks are some, as well as quick-and-easy access to files and directories.

This book is for the skilled Mac user who would like to know a little more about the operating system behind the scenes. There's also information about the Mac's brand of Unix, so someone familiar with Unix but new to the Mac will also find stuff to learn. For those confident in their Mac and Unix skills, however, there's not much new in the book's 168 pages. That's not to say it's a bad book; I found it quite enjoyable to read, and it's a good title to keep in mind to recommend to a Unix novice.

The book begins with an introduction to Terminal.app, the Mac's Unix terminal program. From the very basic (how to find with the Finder) to the fun (how to change the text and background colors) to the useful (how to save terminal sessions into double-clickable .term files), there's much that Terminal has to offer. There's even the cryptic echo '^[]2;My-Window-Title^G' command to change the title of Terminal's window.

The authors then introduce a few simple commands like date and who, and show how to manipulate the terminal's prompt. There's also alias which creates command shortcuts. For instance, if you always run ls with the -F flag, a command alias ls "ls -F" will save you some typing.

Each chapter has two sections which stand out. The "Practice" section gives a list of exercises to try, and the "Problem Checklist" is there to diagnose and fix unexpected behavior.

It's important (especially for those used to other OSes) to understand that in Unix, everything is a file, and all files are organized in the filesystem. This includes plain files, which might be Word documents or system logs; directories, which break up the filesystem into a tree; links, which allow file reuse with different names; devices, drives, etc. All these building blocks of the operating system are discussed. There are also a few pages on vi (which I found quite useful as my vi knowledge up to that point consisted of :q!.) and pico.

Printing on Mac OS X is much like printing on any Unix operating system; you can use pr to format text for line printing, enscript to format for PostScript printing, and lpr to actually queue a printer job. The addition that the Mac provides is a CLI to AppleTalk printers. You can use at_cho_prn to choose an AppleTalk printer and atprint to print to one.

One of Unix's biggest features is its ability to put together small programs to do many different tasks. To count how many files under your home directory are named foo, you can do find ~ -type f -name "foo" | wc -l. By breaking down a problem into components, you only need one-counting program, one file-finding program, etc. The book has a good chapter on this input/output redirection, and how to use those magic top-row characters |, >, >>, and <. Grep (and some light regular expressions) and sort are mentioned as tools for examining text. I thought sed would make a nice addition to this chapter, but perhaps it would lengthen the book too much.

Another advantage of Unix is its true multitasking. What may surprise newcomers to the command-line is that it is possible to run many jobs at once with a single interface. By running commands in the background, one can start large jobs and do other tasks while waiting. In the chapter on multitasking, the & modifier is covered, along with fg, bg, and kill to manipulate processes, and ps and top to report on them.

The command-line interface is lightweight enough that it can easily be extended by a network. This means it's easy (in fact, commonplace) to control a computer different from the one in front of which you're sitting. The authors cover the remote-shell commands ssh and its non-secure cousins, as well as other tools for accessing the internet such as ftp and curl.

The book closes with an introduction to the wealth of open-source software available for Macintosh, now that Macs run a functional Unix. The graphical Unix applications require an X server, which is easy to download and install. The authors show how to install Fink, the Macintosh open-source package manager, and a few big applications like OpenOffice.org and The Gimp.

The last chapter is both a resource list and suggestions for further directions. Those who learn a lot from this book may be interested in picking up shell programming or a scripting language such as Perl.

As I said at the beginning, the book is basic and well-written. Even if you feel it's beneath you, keep the title in mind when a newbie asks what the command-line is all about.


Matthew Leingang is a Preceptor in Mathematics at Harvard University. A funny sentence in the third person escapes him at the moment. You can purchase Learning Unix for Mac OS X Panther from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

cancel ×

337 comments

Sorry! There are no comments related to the filter you selected.

fisst (-1, Troll)

Anonymous Coward | more than 9 years ago | (#10801437)

pr0z7

eye jam r33+

Sad news...Peterson Prosecution Dead at 1 (1)

Shut the fuck up! (572058) | more than 9 years ago | (#10801577)

I just heard some sad news of CNN - The Scott Peterson Prosection died today at 1. Apparently, they 'flip-flopped' in there prosection of the obvious double murderer. Perhaps they took cues from also-ran John Kerry. Both truly American idiotcons.

OSX (-1, Troll)

Anonymous Coward | more than 9 years ago | (#10801440)

OSX is _NOT_ NOT NOT UNIX!!!!!!
It's not BSD and it's not Linux and it certainly doesn't compare to Solaris/AIX.
How many times to we have to explain this!
The mac boys all pretend it is, but hey, anything steve says it true!

Re:OSX (0)

Anonymous Coward | more than 9 years ago | (#10801472)

Considering that BSD is the roots of the modern System V Unix, I think you have a pretty weak case there.

Re:OSX (1, Funny)

Anonymous Coward | more than 9 years ago | (#10801506)

The only "roots" BSD has are the tree roots growing thru its coffin. *BSD is dying. You don't need to be a Kreskin to know that.

Re:OSX (0)

Anonymous Coward | more than 9 years ago | (#10801514)

"A" based on "B" based on "C" does not mean "A"=="B"

Word Count in Word (5, Insightful)

AKAImBatman (238306) | more than 9 years ago | (#10801442)

Think: do you know how to count the words in a Word file?

Tools -> Word Count

Why is that so hard? It's File -> Properties -> Statistics in OpenOffice.

Re:Word Count in Word (2, Informative)

CerebusUS (21051) | more than 9 years ago | (#10801475)

And if word count is that important to you, you can always add it to the toolbar. Then it's just a matter of hitting "Alt-C"

Thank goodness UNIX is in the West (-1, Troll)

Anonymous Coward | more than 9 years ago | (#10801494)

The good news is that UNIX was invented by a Western and indicates that innovation in the West is alive and well. If UNIX were invented by a Chinese, he would have used it to concoct "better" means of torturing prisoners, women, children, Tibetans, etc. [tibet.org] .

Re:Word Count in Word (1)

PopCulture (536272) | more than 9 years ago | (#10801499)

yeah pretty funny also:

To count how many files under your home directory are named foo, you can do find ~ -type f -name "foo" | wc -l

which is obviously a lot more intuitive than opening up File Explorer and sorting by file name... isn't it ;)

Re:Word Count in Word (4, Funny)

fimbulvetr (598306) | more than 9 years ago | (#10801535)

It's faster. find ~/ -type f | wc -l is easier finding my mouse, plugging it in, waiting for usb to init, then navigating around.

Re:Word Count in Word (1)

bsartist (550317) | more than 9 years ago | (#10801660)

Yeah, and walking to the store is faster if you have to build a car before you can drive there. Why do zealots always make such ridiculous comparisons?

Re:Word Count in Word (1)

fimbulvetr (598306) | more than 9 years ago | (#10801736)

Yeah, that would suck. Good thing king soopers delivers.
HAHA, welcome to /., where someone throws the word "zealot" in because it makes himself feel better. Good luck with that.

Re:Word Count in Word (5, Insightful)

Jeff DeMaagd (2015) | more than 9 years ago | (#10801692)

It's faster. find ~/ -type f | wc -l is easier finding my mouse, plugging it in, waiting for usb to init, then navigating around.

Wow. I think you'd make a great benchmark designer. Pick an obscure task that almost nobody needs done, stack the "other" side with an unusual configuration for modern computers and use it as a case in declare that "your" way is a lot better in general.

Re:Word Count in Word (1)

fimbulvetr (598306) | more than 9 years ago | (#10801751)

You'd think so? I don't know. See *most* of us "Unix guys" really don't even use a gui. Hope your bitter sarcasm really gets the next guy though, because I was a bit disappointed.

Re:Word Count in Word (1)

stratjakt (596332) | more than 9 years ago | (#10801571)

Or using the find feature, if you want a more esoteric count (wildcards and such).

What if you want to count all the word and excel documents that contain the phrase "unix can jump up my ass"?

Huh, jack? Where's your command line tool for that?

Re:Word Count in Word (1, Funny)

Anonymous Coward | more than 9 years ago | (#10801633)

it's called grep

Re:Word Count in Word (5, Informative)

smcdow (114828) | more than 9 years ago | (#10801729)

What if you want to count all the word and excel documents that contain the phrase "unix can jump up my ass"? Huh, jack? Where's your command line tool for that?
find ~/. -type f | egrep '\.(doc,xls)$' | xargs grep -l 'unix can jump up my ass' | wc -l

Easy peasy.

Re:Word Count in Word (0)

Anonymous Coward | more than 9 years ago | (#10801786)

what if the phrase is broken between lines?

Re:Word Count in Word (1)

neonleonb (723406) | more than 9 years ago | (#10801767)

As someone anonymously posted, "grep" is exactly that tool.

Now, what if you want to know the length of all of your book's chapters that include the phrase "unix can jump up my ass"? Or how many occurrences of that phrase are in each chapter? Command-line tools are great for stuff like that, while Windows's Find tool requires you to open each one by hand and check this stuff out.

Re:Word Count in Word (0)

Anonymous Coward | more than 9 years ago | (#10801637)

The script (find ~ -type f -name "foo" | wc -l) finds files in the home directory and subdirectories named "foo" exactly (not foo.this, tarfoo, etc.). Wildcarding can change it to match files with names that start with, end with, or contain a string. Opening File Explorer and sorting by file name (and scrolling or typing starting letter) will find files in the directory (not subdirectories) that start with whatever you've scrolled to, and then you have to count them manually.

Speed of command lin (2, Insightful)

SeanDuggan (732224) | more than 9 years ago | (#10801711)

Actually, given how slow Windows Explorer tends to be parsing directories, yes it may be much faster. I still remember a friend of mine deleting a large directory of temporary items. After 10 minutes of waiting for windows to finish displaying the whole directory, he dropped down to MS-DOS and deleted them all with one command and about 5 seconds of runtime.

There are definitely speed advantages to command lines.

Re:Word Count in Word (1, Interesting)

dsanfte (443781) | more than 9 years ago | (#10801501)

The GUI is another obfuscation and a hinderance to people who know what they want to do, and just want it done.

I like to view it like this:

With a command line, you speak directly to the program, if you know the language to use.

A GUI is going through an intermediary translator who organizes words by categories you don't recognize, obfuscating an already complicated task by playing hide-and-go-seek with nested menus.

Re:Word Count in Word (5, Funny)

geoffspear (692508) | more than 9 years ago | (#10801559)

The command line is an obfuscation and a hinderence to people who really know what they want to do.

If you hook wires up to all the pins on your processor and move them really quickly between connections for the voltages corresponding to 0 and 1, you speak directly to the machine, if you know the language to use. And have really fast hands.

A command line translates your typing into a language your computer can understand.

Re:Word Count in Word (2, Insightful)

ViolentGreen (704134) | more than 9 years ago | (#10801822)

The command line is an obfuscation and a hinderence to people who really know what they want to do.

I'd like to modify that to say "The command line is an obfuscation and a hinderence to people who only know what they want to do and not how to do it."

The command line is extremly powerful. The GUI has it's place though. If you put someone in front of a command line with no insturction, they will have trouble getting around. There are 100+ keys on a keyboard as opposed to 2(3) buttons on a mouse. If you do enought clicking on any desktop environment, you can figure out how to get at least somthing done.

A GUI can be superior to a command prompt in some situations as well. Say you want to move 15 dissimilarly named files in one directory to another. In a GUI, you open up two "explorer" windows, use your mouse to select exactly which files you want and drag them to the other window. With a CLI, you have to type the 15 distinct file names as well as the destination folder. You could end up with the final command being 3-4 lines long and are more likely to make errors.

A GUI can make things easy that are tedious in a CLI. A CLI can make things easy that are tedious in a GUI.

Thankfully you don't have to choose one or the other. There's no reason to.

Re:Word Count in Word (2, Insightful)

MrBlackBand (715820) | more than 9 years ago | (#10801573)

With a command line, you speak directly to the program, if you know the language to use.

But what if you don't know the language to use? That's the main advantage of a GUI over a CLI. If you don't know how to do a word count in a command line environment then you must resort to looking it up in help. If you don't know how to do a word count in a GUI then all you have to do is explore the menus to find the command. Every command is already there right in front of you.

Word: wc with too many "features" (4, Funny)

Flexagon (740643) | more than 9 years ago | (#10801524)

There's no GUI analogue, perhaps because anybody tempted to make one would add too many "features" that cluttered its ease of use. Think: do you know how to count the words in a Word file?

Tools -> Word Count

Yes, Word could be considered to be wc with too many other "features"!

Re:Word: wc with too many "features" (0)

Anonymous Coward | more than 9 years ago | (#10801545)

Actually, word would be VI w/ too many features...

Word Count is just a wc plugin to VI. :-)

Re:Word Count in Word (1)

kamelkev (114875) | more than 9 years ago | (#10801530)

Hey, you're ruining this posters moment in the spotlight. Don't tear him down yet - wait 20 minutes like the rest of us!

Re:Word Count in Word (1)

SilentChris (452960) | more than 9 years ago | (#10801533)

But what if you want to do the word count of 50 files, and print the results? Using the command line, you can get this done in under 5 seconds.

Re:Word Count in Word (1)

AKAImBatman (238306) | more than 9 years ago | (#10801675)

Don't get me wrong. I use 'wc' all the time. I just think the poster's comparison to Word is a bit silly.

Re:Word Count in Word (0)

SilentChris (452960) | more than 9 years ago | (#10801742)

Well, I can see what he's getting at.

The average computer user would probably know where the Word Count command is in Word no more than wc on the command line. They would, however, have an inkling of where to look (Tools on the menu bar should jump out of them). It's often a lot easier to find what you're looking for in a GUI.

Linguistic origins (3, Informative)

2.7182 (819680) | more than 9 years ago | (#10801443)

In an old paper by Ritchie, it is pointed out that Unix comes from the Old Dutch, Unochs, which means "tree-based".

Re:Linguistic origins (2, Informative)

ikewillis (586793) | more than 9 years ago | (#10801570)

Wrong. The name Unix is an abbreviation of UNICS, which stands for UNiplexed Information and Computing Service, a play on MULTICS, MULTiplexed Information and Computing Service

Re:Linguistic origins (1)

Feminist-Mom (816033) | more than 9 years ago | (#10801635)

No, I am afraid that you are the one who is wrong. That is a common misconception, that Ritchie is trying to clear up.

Re:Linguistic origins (1)

winkydink (650484) | more than 9 years ago | (#10801703)

Well he's being awfully quiet about it. There's no mention of it on his home page [bell-labs.com] .

Re:Linguistic origins (1)

AKAImBatman (238306) | more than 9 years ago | (#10801749)

1. Ken Thompson created and named it after he felt that the MULTICS project was too complex. Ritchie came later and did the C compiler.

2. Have a link? Here's mine: http://www.uwsg.iu.edu/usail/concepts/unixhx.html [iu.edu]

Re:Linguistic origins (1)

phloydde1 (528605) | more than 9 years ago | (#10801593)

I thought it came fron eunuch.

Re:Linguistic origins (1)

winkydink (650484) | more than 9 years ago | (#10801720)

That was the double-entendre in UNICS

*looks surprised" (1)

jawtheshark (198669) | more than 9 years ago | (#10801740)

My mother tongue is dutch... Modern dutch of course. I never heard that "Unochs" means "tree-based" in Old Dutch. A tree in dutch (modern that is) is called "boom" (ponunication "b-ohm").

Of course my Old Dutch doesn't go further than "Hebban olla vogalan nestas higonan" [xs4all.nl] . ;-)

Re:*looks surprised" (1)

2.7182 (819680) | more than 9 years ago | (#10801776)

That is because it is from a special dialect, whaling Dutch.

Re:Linguistic origins (1)

Anne Thwacks (531696) | more than 9 years ago | (#10801777)

I think the old English word Bo-Lucks comes to mind!

Command line in OSX (2, Insightful)

trisweb (690296) | more than 9 years ago | (#10801446)

Just the other day I was fixing a friend's mac, and while I hadn't used OSX all that much, I do use linux, so I asked him, "okay, open up a terminal" because I knew it was possible, and it was so nice to be able to use (just about) everything I could in linux. It's definately something I wish Windows had...

Re:Command line in OSX (1)

2.7182 (819680) | more than 9 years ago | (#10801489)

Windows does have it - look at www.cygwin.org.
Cygwin is Unix tools for windows.

Re:Command line in OSX (1)

rppp01 (236599) | more than 9 years ago | (#10801532)

I use it at work. With 'X', ssh, and so on.

It 'works' for the most part. I get issues with 'X' and things like WebSphere installers and Admin GUI clients.

But for straight command line that is pretty seemless with Windows, I agree, it works very well.

MS's SFU is a hunk of junk by comparison.

Re:Command line in OSX (3, Interesting)

trisweb (690296) | more than 9 years ago | (#10801612)

Oh yeah, well I know and love Cygwin, but you can't exactly go up to anyone's system and say "okay, now open up a Cygwin terminal... ... Oh, what's that, you have no idea what I'm talking about because it doesn't come with Windows and isn't attached to Internet Explorer?"

I manage a dorm network with 44 computers, mine is the only one with cygwin installed, I guarantee it. So it's nice to go up to a Mac, open a terminal, and have it be useful.

Re:Command line in OSX (0)

Anonymous Coward | more than 9 years ago | (#10801493)

You could have your own rap song:
I'm sorry mama, I'm coming out of the closet.

Re:Command line in OSX (-1, Flamebait)

Anonymous Coward | more than 9 years ago | (#10801611)

ahhh, yeah moron it does. Ever tried CMD from START -> RUN?

You fucking Linux people are such dorks.

Re:Command line in OSX (1)

DavidLeblond (267211) | more than 9 years ago | (#10801683)

Are you seriously saying that cmd in Windows is as functional as a terminal on Linux/Mac?

Wow.

Re:Command line in OSX (2)

NardofDoom (821951) | more than 9 years ago | (#10801791)

An even better reason to learn the command line on your Mac is so you can SSH into it from a remote location. I use this all the time at work to download software updates and files. Right now I'm downloading NeoOffice to play with later.

I can also administer it remotely. Handy for when my wife has some sort of problem with something, or when I have a spare minute and want to do something on my home computer.

In Word (-1, Redundant)

Anonymous Coward | more than 9 years ago | (#10801447)

Yeah, in Word you go to Tools -> Word Count, wow that was hard.

Do you know how to count the words in a Word (-1, Redundant)

jayayeem (247877) | more than 9 years ago | (#10801453)

File -> Properties -> Statistics (at least in my version of word, 2001 or XP or something)

Count Words in MS Word? (0, Redundant)

spockman (532973) | more than 9 years ago | (#10801458)

Statement says "Think: do you know how to count the words in a Word file?" Answer: In MS Word that would be Tools/Word count not real tough.

Yep! (1)

stratjakt (596332) | more than 9 years ago | (#10801460)

Think: do you know how to count the words in a Word file?

File->Properties, Statistics tab

Pages, Paragraphs, Lines, Words, Charachters with or Without Spaces.

What's my prize?

Count words in BBEdit (3, Informative)

Anonymous Coward | more than 9 years ago | (#10801466)

BBEdit is a little easier, if you know the button to click.


Yea, the big freaking button with "i" in a circle right in the middle of toobar. It will tell you characters, words, lines and pages. Even easier and faster to use than wc.

Or, you can set a menu key (1)

oneiros27 (46144) | more than 9 years ago | (#10801797)

A little time up front now, and you can save more time in the future:
BBEdit -> Set Menu Keys...
Then look for:
Window -> Get Info

Another fantastic read. (0)

Anonymous Coward | more than 9 years ago | (#10801469)

Eight thumbs up!

wc gui analog (1)

gnurb (632580) | more than 9 years ago | (#10801470)

I predict by the end of this discussion either one will be found, or one will be programmed.

Also, buy [amazon.com] the book at Amazon and save a good 4 bucks compared to BN. Yeah, that's an affiliate link in there you weenies

Do you know how to count words at all? (4, Informative)

YU Nicks NE Way (129084) | more than 9 years ago | (#10801483)

Did you know that the number of words in a document is not a single value, but depends on the use of the document? I'm sure that Stephenson does know that: if you're writing for some audiences, you don't count the words in foot- or endnotes, whereas for others, you do. If you're writing for some audiences, you don't count "short words", whereas for others, you do.

And, of course, if you're writing in Japanese, wc counts your entire document as being one word long.

What does this have to do with Unix? It's a classic example of Einstein's dictum that everything should be made as simple as possible, but no simpler. The Unix command wc is a classic exmple.

Re:Do you know how to count words at all? (1)

geoffspear (692508) | more than 9 years ago | (#10801603)

And wc does a very poor job of counting the words in a Word document, too. Not to mention an HTML document.

Re:Do you know how to count words at all? (1)

cortana (588495) | more than 9 years ago | (#10801728)

Perhaps you should pass your document through a program that converts the content to text first?

cat blah.html | html2txt | wc
cat blah.doc | deword | wc

Ok, I made deword up, because I forgot the name of the program that makes a Word document in to text.

Re:Do you know how to count words at all? (1)

cortana (588495) | more than 9 years ago | (#10801770)

The only problem I have with using LaTeX is that there is seemingly no way to accuratly count words. I ended up with the following:

alias texwc='dvi2tty report.dvi | sed "s/\. \.//g" | sed "s/ \. //g" | sed "s/ [A-Za-z]*-$//" | sed "s/.*_$//" | wc -w'

Pretty nasty! The seds remove the junk that artificially inflates the word count the most, like page numbers, page headers and the table of contents. What I really need is something like:

dvi2tty --for-screen report.dvi | wc

where --for-screen makes dvi2tty format the output for a screen rather than for printing to a line printer. Ironically this would make it perform the function that its name matches! :)

Mac and the command line (1)

crimson_alligator (768283) | more than 9 years ago | (#10801486)

The above did not mention Darwinports, an excellent alternative to Fink. http://darwinports.opendarwin.org/ [opendarwin.org]

I live in the terminal on my ibook. Darwinports provided wget, unison, tin, links, mutt, irssi, anacron, and a ton of other Unix stuff. Of course Macs already come with vim, emacs, and the ability to alias emacs='vim'.

Roll up your sleeves and open that terminal!

Re:Mac and the command line (1)

geoffspear (692508) | more than 9 years ago | (#10801656)

Only a fan of vi could be dumb enough to forget that emacs isn't his favorite editor, and need to alias it to prevent accidentally running emacs.

An emacs fan would never even consider typing "vi" on the command line.

Re:Mac and the command line (0)

Anonymous Coward | more than 9 years ago | (#10801690)

Wow the ability to alias.. What a world class OS.

Re:Mac and the command line (0)

Anonymous Coward | more than 9 years ago | (#10801708)

Wow the ability to alias. What a world class OS.

Mac vs Unix (3, Interesting)

rppp01 (236599) | more than 9 years ago | (#10801487)

I have used Unix, Linux and Windows for years. I recently switched to Mac at home.

I find it uncomfortable for obvious reasons (new way of doing things). Yet, while I only do file movement, touches, etc via the command line in unix/linux, and I only do GUI file touches, movement, etc on Windows, I find myself using an unwieldy GUI (Finder) to do the same thing on Mac. I can fire up an xterm and do it that way, but I don't 'want' to.

That is odd for me. Can't quite explain it. Mac is (even as a unix variant) its own creature. It leaves me feeling like I have the power of the universe in a little pretty living space.

Maybe cause I am new to it still.

Re:Mac vs Unix (0)

Anonymous Coward | more than 9 years ago | (#10801800)

If you have a spare PC, maybe you might want to try FreeBSD on it. There are some slight differences between the FreeBSD command line interface and some of the Linux distribution interfaces that you may prefer. Mac OS X/Darwin is very loosely based on FreeBSD. I like Mac OS X/Darwin because it reminds me of the good old SunOS 4 days.

Good points (3, Interesting)

SilentChris (452960) | more than 9 years ago | (#10801491)

I recently got an iBook (recently as in 6 months ago) after installing a G5 for a user in our art department. I'm not sure I'm a big fan of Apple's hardware or pricing schemes ($600 for an iPod that plays photos), but Mac OS X is pretty robust.

What I especially like about their use of the Terminal is pretty much anything that can be done in the OS, can be done on the command line. Example: changing a computer's name. Think fast: how does one do this in Windows? If you started saying "command line, net with options..." you know more than most. Windows coerces you to use the GUI. Mac encourages it, but doesn't force it (at least, since they got rid of OS 9).

Not to mention the Fink project, which adds tons of great apps to the command line. Again, I'm no Apple zealot, but their decision to have a robust command line in OS X was a great one.

Re:Good points (1)

stratjakt (596332) | more than 9 years ago | (#10801522)

Windows coerces you to use the GUI. Mac encourages it, but doesn't force it

Please, windows doesn't "force" you to use the GUI any more than Mac does.

And your average user doesn't know how to do it in Mac either. I'm assuming its typing it in /etc/HOSTNAME, or probably - in true Unix fashion, this file is in some other folder and is named something totally differnent, right?

In gentoo, you gotta screw around in /etc/conf.d to set the hostname. Slackware sets it up in one of its /etc/rc.d/* init scripts, etc.

Re:Good points (5, Informative)

AKAImBatman (238306) | more than 9 years ago | (#10801579)

Not to mention the Fink project, which adds tons of great apps to the command line.

Fink is nice, but it tends to make something of a mess. Even worse, that mess is mixed in with your current files, making it difficult to clean up later. I've found that http://packages.opendarwin.org [opendarwin.org] works better. Don't access it through your web browser. just select finder, then click on the "Go" menu, then "Connect to Server...". Place that URL in the textfield and click "OK". You should now have a WebDAV archive of opensource binaries mounted on your desktop.

Have fun!

Re:Good points (3, Informative)

bsartist (550317) | more than 9 years ago | (#10801725)

Even worse, that mess is mixed in with your current files

Wrong. Everything Fink installs is found under /sw - *nothing* is "mixed in with your current files".

Re:Good points (1)

AKAImBatman (238306) | more than 9 years ago | (#10801831)

Seems you're right. The installer must have been showing me relative paths. *whew* At least now I can clean up that junk. :-)

Re:Good points (2, Informative)

justMichael (606509) | more than 9 years ago | (#10801796)

Fink is nice, but it tends to make something of a mess. Even worse, that mess is mixed in with your current files, making it difficult to clean up later.
Umm, not to sound like an ass, but...

1) Launch Terminal.app
2) sudo rm -rf /sw
3) Fink is nothing but a memory ;)

XP home (0)

Anonymous Coward | more than 9 years ago | (#10801701)

If you are gonna do complex stuff, get that command line out. Most of the features that MS says were removed are right there waiting for you to use them.

Umm, yeah (1)

MichaelPenne (605299) | more than 9 years ago | (#10801495)

Think: do you know how to count the words in a Word file?

Leingang doesn't?

I mean I'm all for MacOSX and I often use the command line, but I also think clicking "Tools" and selecting "Word Count" from the drop down is more fun than typing a string of commands into a CLI.

You're being disingenuous (5, Insightful)

Dink Paisy (823325) | more than 9 years ago | (#10801504)

In Microsoft Word, I go to the "Tools" menu and choose "Word Count..."

For my current document, it reads:

Statistics:
Pages 23
Words 10,234
Characters (no spaces) 52,996
Characters (with spaces) 63,140
Paragraphs 107
Lines 660

One of the really nice things about GUI's is that they make rarely used commands (like word count) really easy to discover. You just look in the menu, and there it is. Compare that to a UNIX command prompt, where if you don't know how to write scripts and you don't know that the "wc" command is for word counts, you are lost.

Re:You're being disingenuous (0)

Anonymous Coward | more than 9 years ago | (#10801628)

Well, I won't disagree with you outright. However, it might be easier than you think under unix.

% apropos count words | grep "(1)"

gives me 10 results including "wc" - it's pretty easy to figure out "wc" is right from the command summaries it gives you.

Having to grep against "(1)" is annoying, but it just means to only show results for executables as opposed to libraries, &c.

adding to my previous response (3, Insightful)

Dink Paisy (823325) | more than 9 years ago | (#10801681)

The author of the review (and apparently the author of the book as well) are proponents of the view that each tool should be as simple as possible and do one job well. That just doesn't make sense any more. Now we have large, monolithic command line tools that can do many jobs well.

Having one large, all-purpose tool is better because instead of having to learn many simple tools with different syntax and stringing them all together in a massive chain of fork()'s and file handles, we can use a single tool that is more sophisticated, more consistent, and more resource efficient for big tasks. As Rob Pike said in his interview here [slashdot.org] so recently, the days of one tool doing one job well "are dead and gone and the eulogy was delivered by Perl."

Hear Hear (1)

Altus (1034) | more than 9 years ago | (#10801817)


id mod you up if I could.

people are quick to laud the CLI and bash the GUI but there are advatages to both... and the discussion is not complete without looking at all of this. I have used the command line plenty, in both Mac OS X and in other flavors of UNIX. I have never used "wc" and wouldnt have even thought to type "wc" to get a word count on a document. Word count isnt something that I have had the need for, but if I did, it would be a lot easier to discover how to do it in word (or BBEdit, which is really easy) that to try and guess what command would do it from the CLI.

the hard way (4, Funny)

byrd77 (171150) | more than 9 years ago | (#10801505)

grep -v -c "Something I know is not in the file" file.txt

The EASY way! (1)

Anonymous Coward | more than 9 years ago | (#10801652)

ls file.txt, note filesize and divide by 4.

That is if, like me, your writing mainly consists of four letter words.

Money money money money... (1)

cloudkj (685320) | more than 9 years ago | (#10801516)

Get a great deal on this great book here [amazon.com] and save yourself $4!

Get Mod 0 for MS Answer - Higher if OO or Combo (3, Interesting)

spockman (532973) | more than 9 years ago | (#10801519)

I see how this works now. If you only answered with the MS way you get modded 0 but if you used the OO answer or a combination of MS and OO you get modded higher.

Re:Get Mod 0 for MS Answer - Higher if OO or Combo (1)

FerretFrottage (714136) | more than 9 years ago | (#10801673)

36 words (counted using MyIs)

Related titles (2, Interesting)

lpangelrob2 (721920) | more than 9 years ago | (#10801537)

Earlier this year I picked up Mac OS X Panther for UNIX Geeks [oreilly.com] , since I decided I probably should know a bit more about UNIX. (Plus the foreword said, hey, even if you just update a website that has UNIX on its webserver, the book is for you.) Needless to say, that particular book hurt my head, and I think I probably should have picked up Learning Unix for Mac OS X Panther instead. Whoops.

As I am considering the advanced Unix users that browse this forum, I'd suggest having a look at that book too/instead.

Typical OS bigotry (2, Insightful)

Anonymous Coward | more than 9 years ago | (#10801575)

Do I know how to count characters in a word document? Certainly. And, best of all, it will actually count characters, in any character set, not just in ASCII or other similar 7/8 bit sets.

But that's not really the point. Knowing how to do something in one OS does not make the one you are ignorant about an inferior OS. If you truly do know both OSes, then I'll listen to your opinions. Until then, I'd stay away from making comparisons.

It is the height of arrogance to assume that if you don't know something that it must not exist.

More retarded assery from the zealot front (4, Interesting)

stratjakt (596332) | more than 9 years ago | (#10801631)

A robust programmable command line is a great tool, but for completely different reasons than listed.

It's powerful because you can create intelligent scripts to automate tasks. Then you launch those scripts by clicking them.

You aren't going to win anyone over by typing in some esoteric "find ~ blah | fart pipe * & (! exemo!'" command, when you could have just opened the search box and typed "foo". You're just going to look like an elitest dick.

Once upon a time, I knew all those stupid commands and switches and would pipe output through 98 different little apps to find something out.

Now I'm happy as a clam to spend my time and energy doing other things with my computer.

This summary, at least, is all about "using a command line to make simple tasks harder so that you can feel like a real 1337 h4z0r everytime you do something so mundane as count the words in a file"

wc: (1)

DogDude (805747) | more than 9 years ago | (#10801632)

Textpad: View, Properties

I still contend that Textpad is the best text editor that I've ever seen.

Re:wc: (0)

Anonymous Coward | more than 9 years ago | (#10801818)

Agreed. Its a must for any windows coder :)

Let the GUI v CLI battle commence (1)

RealProgrammer (723725) | more than 9 years ago | (#10801654)

I'm a CLI guy. I use a browser, but I feel bad about it :-).

I've been looking for a simple X application that was a pipe interrupter, sort of a GUI 'cat', call it 'xcat'. The idea is to type a command like:
xcat foo.c | wc -l
and xcat would fill its buffer with foo.c, pop up to let you modify the buffer, and send the results to 'wc -l'.

There are a lot of times when I want to gather text from a variety of places (including GUI places) and run it through a command line filter. An 'xcat' would help unify my world a bit.

I end up typing (to continue the example)
vi foo.c
(inside vi:)
!Gwc -l
to pipe the contents of vi's buffer through 'wc -l'. It's not optimal.

Looking for 'xcat' made me feel guilty for not knowing how to program for X Windows. Researching how to program for X Windows made me like the command line! There doesn't seem to be a simple, cross-platform, it'll work everywhere, X toolkit.

Now I just hate the world, and will retreat into my own bitterness.

Re:Let the GUI v CLI battle commence (0)

Anonymous Coward | more than 9 years ago | (#10801709)

man sed

I am wiser now. (2, Informative)

kahei (466208) | more than 9 years ago | (#10801668)

The fact that Neal Stephenson, the commentator, and the person who accepted the article were able to write and read so much about the subject without ever noticing all the obvious and commonly used GUI counterparts to wc -- many of which are considerably more interesting, for instance Word does a little morphological analysis to count Japanese words -- says something desperately sad about those people and perhaps about the culture they are from.

But the fact that so many slashdotters stepped up already and cared enough about nitpicking the record straight that they have posted the path to the word count tool in Word at least half a dozen times already, fills me with hope!

I feel as if I have gained wisdom from this simultaneous despair and revival. The feeling is probably false, though.

Incidentally, the finest and most satisfying way to count words (if wc's answer is good enough) is to use wc... from vim.

Re:I am wiser now. (1)

argent (18001) | more than 9 years ago | (#10801832)

the obvious and commonly used GUI counterparts to wc -- many of which are considerably more interesting

Can you use them to count the words added to a file every five minutes, to count the words ONLY on the lines beginning with "IMPORTANT", to count the number of words past the 40th character on long lines, to count the number of words in the ID3 titles in your iTunes Music folder, ...

the finest and most satisfying way to count words (if wc's answer is good enough) is to use wc... from vim.

Heretic. Luckily the nvi from Jaguar runs on Panther.

how many ways to do wc in a gui (word) (5, Insightful)

yagu (721525) | more than 9 years ago | (#10801674)

Already I'm seeing in the posts exactly what and why CLI users throw up their hands trying to deal with GUI.... and "wc" is a pretty good example. When the OP asked Think: do you know how to count the words in a Word file?, I knew without even reading on in the posts I was going to encounter (and, I did):

  • at least two versions/ways to do wc in a word doc within the first 10 posts, and....
  • a real attitude from the anointed who had the "answer".

For those who didn't bother to sign up for the clue, the question was mostly rhetorical, and was an example of the diff between CLI and GUI. I know my immediate response wasn't, "I know EXACTLY how to do that in word," but rather, "Hmmmmm, I know I've solved that and found that "option" SOMEWHERE in word before, but I don't remember exactly where..."

OTOH, were you to ask CLI users the same question.... they would all know exactly how to use wc, and interestingly enough, had you asked the same question to the CLI users over the past fifteen years you would have gotten the same answers. So, in addition to a simple answer, CLI is a consistent one.

P.S.And don't even get me started about the menus with chevrons! Assuming for the sake of argument we are talking about the current version of WORD, have YOU ever tried to walk someone through this kind of stuff over the phone? With MS' genius implementation of self-modifying menus, you could "claim" something is in a menu when trying to help someone when in fact because of their use menus, their menu is completely different from yours.

Re:how many ways to do wc in a gui (word) (2, Informative)

Chess_the_cat (653159) | more than 9 years ago | (#10801789)

And don't even get me started about the menus with chevrons! Assuming for the sake of argument we are talking about the current version of WORD, have YOU ever tried to walk someone through this kind of stuff over the phone? With MS' genius implementation of self-modifying menus, you could "claim" something is in a menu when trying to help someone when in fact because of their use menus, their menu is completely different from yours.

Without knowing where it was beforehand it took me about 5 seconds to find the following:

Right click on any Toolbar, Customize, Options, and check "Always show full menus."

Re:how many ways to do wc in a gui (word) (0)

Anonymous Coward | more than 9 years ago | (#10801790)

Read Jef Raskin's book, "The Humane Interface" [amazon.com] , about user interface design. He uses many Windows examples to demonstrate bad design decisions. Nested menus and menus that change are two classic examples of designs to avoid.

Useful, acutally. (0, Troll)

smcdow (114828) | more than 9 years ago | (#10801688)

I played with an OS X machine the other day. I found a terminal program which gave me a CLI. At that point, it became useful.

No wonder I couldn't print (1)

tepeka (572431) | more than 9 years ago | (#10801750)

I thought 'at_cho_prn' was the command line way of selecting where to download pr0n...

Word 2004 ALWAYS shows word count (3, Informative)

benwaggoner (513209) | more than 9 years ago | (#10801755)

Guys,

The default install of Word 2004 for Mac always shows the word count, in the lower right hand corner. It shows it as XXX/YYY, where XXX is how many words are before the cursor, and YYY is for the entire document.

As a professional writer, I can't imagine what wc would offer me that would be better than that! I often work on very specific total word targets for articles, so I can track if I'm under or (much more likely) over, and tweak accordingly.

Personally, I haven't been able to use Word on Windows since they started putting the icons in the wrong place in the menus. The PowerBook 17" is the ideal writing machine today, in my opinion.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>