4354indx.fm Page 427 Wednesday, October 20, 2004 10:58 AM

Index

Note to the reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations.

Symbols A Applications folder, 161 - (dash), in file names, 51 absolute mode for chmod command, 299 utilities subfolder, 1 !$ shortcut, for substituting arguments, 140 changing permissions, 300–301 apropos command, 41 !! command, 140 and sticky bit, 304 man page for, 44 ! (exclamation point) absolute paths, 53–55 overview, 42 for negating commands, 194 for cd command, 77 archives as shortcut for commands, 144 for symbolic links, 114 adding multiple files to, 264 # symbol for comments accented characters, in file names, 52 disk images for, 270–275 in /etc/sudoers file, 315 active memory, 363 finding text in compressed, 185 in crontab file, 418 Activity Monitor, 367 tar to create, 267–269 in .tcshrc file, 411 administrator accounts, 278–279 arguments for commands, 4, 35, 38–39 $ (prompt character), 2, 13 password for cloning Mac OS X command editing to change, 141 % prompt, 13 startup volume, 126 shortcut for substituting, 140 * (asterisk) as wildcard, 52, 192–193 and sudo command, 306 arrow key , 150 cp (copy) command with, 100 –101 administrator processes, 361 asr (Apple Restore) command, 393 in find command, 172 Aladdin’s StuffIt, 261, 269 asterisk (*) as wildcard, 52, 192–193 in ls listing, 64 alerts, bell or flashing window as, 17 cp (copy) command with, 100 –101 in wc command, 212 aliases, 112–118 in find command, 172 . (dot) for combining commands, 420–421 in ls listing, 64 for current directory, 7 and command line, 114–115 in wc command, 212 as initial directory file, 79, 81 with open command, 156 attributes for files leading, in file names, 53, 64 properties and usage, 117 GetFileInfo command to return, .. (dot dot), as initial directory file, 79, 81 removing, 416 397–398 .. (parent directory), 8, 55 for rm command, 109 SetFile command for, 398 moving to, 81 setting shell, 414–416 audible bell, 17 opening in , 154 for Terminal, 10 autodiskmount utility, 125 / (slash), 50 for users, in /etc/sudoers file, autolist variable (tsch), 135, 136 in ls listing, 64 315–316 automating commands, 418–424 : (colon) viewing listing, 416 with AppleScript, 422–423 and file names, 50 Alsoft Disk Warrior, 386 combining commands, 420–421 in Terminal window, 45 anti-aliasing, 21 creating double-clickable command ? (question mark) as wildcard, 193 appending files, 421–422 for special characters in file names, 52 command output to file, 89 B [ ] (brackets) as wildcards, 193–194 concatenated files to another file, backups \ (backslash) as escape character, 196 201–202 across network, 123 \! (not) operator, for find command, 177 Apple Developer Connection, 394 ditto command for, 119, 121–122 ^ (caret) Apple Developer Tools. See Developer COPYRIGHTED MATERIALof NetInfo database, 282–283 for Control key, 228 Tools rsync command for, 329 for typing corrections, 152 (asr) command, Bash Reference Manual, 402 _ (underscore), in file names, 52 393 bash shell, 9, 11, 401 { } characters as wildcards, 194–195 AppleCare protection, 386 CDPATH variable, 81 ~ (home) directory, 4 AppleDouble files, 119 command completion, 136–138 ~ (tilde) AppleScript, 422–423 command history, 85, 138, 144–146 in file names, 51 applications environment variables for, 406–410 for navigation shortcuts, 78 ditto command to copy, 120–121 escaping non-ASCII characters, 17 < (input redirection operator), 89–90 open command for, 155–156 history file, 147 > (output redirection operator), 75, 89 report on, 376 information about, 151

4354indx.fm Page 428 Wednesday, October 20, 2004 10:58 AM

428 .BASH_LOGIN FILE • COMMANDS

noclobber variable, 90 C closing Terminal windows, 26 prompt, 61 cancel command, 253–254 collating printed documents, 248 setting default editor, 234 overview, 254 colon (:) shutdown process, 404 Carbon Copy Cloner, 124 and file names, 50 startup process, 402–403 caret (^), for typing corrections, 152 in Terminal window, 45 turning off case sensitivity for filename carriage returns, newlines as, 17 color output, from ls command, 73 completion, 133 case sensitivity, 131 color settings for Terminal display, 22 .bash_login file, bash shell use of, 403 of command options, 5, 35 .command extension, 421 .bash_profile file, 406 for filename completion, 131 command history, 138–150 bash shell use of, 403 turning off, 133 with bash, 144–146 HISTCONTROL variable, 147 of grep command, 181 fc command, 145–146 history search shortcut setup, 145 of locate command, 167 quick search, 145 HISTSIZE variable, 147 symbolic links and, 118 clearing, 148–149 settings for ls command color display, cat (concatenate) command, 6, 201–203 displaying, 143 73 overview, 202 editing commands, 140–142 shell aliases in, 414 cd (change directory) command, 5–6, 8, modifying commands, 140 BBEdit, 227 38–39, 75–86 numbers for short list, 149 and grep, 185 with ftp, 337 running specific command, 144 setting as default editor, 234 navigation shortcuts, 77–83 shortcut, 139 BBEdit Lite, 227 to home directory, 77–78 variable, 147–148 bell as alert, 17 moving back and forth, 79 command-line interface, 10 binary files, file command and, 200 moving up and down, 79, 81 and, 114–115 bind command (bash), 150 overview, 82 commands from within , bindings. See keyboard shortcuts in CDPATH variable for bash shell, 81 422 Terminal cdpath variable for tcsh shell, 81 compiling AppleScripts from, 422 bindkey command (tcsh), 150 character classes for file management, 98 “bit-bucket” directory, sending error in grep, 187 for printer management, 255 to, 172 in tr command, 220–221 for quitting processes, 371–373 bless command, 386–387 character set encoding, 21 for user account creation, 280–281 overview, 387 characters command mode in vi, 235 blinking cursor, 20 replacing, 219–221 “Command not found” error message, 50 blinking text, 21 wc command to count, 212 commands block cursor, 19 chmod command, 299, 424 aliases for shortcuts, 414 Bombich, Mike, 124 absolute mode, 300–301 arguments for, 38–39 boot process, 384 overview, 302 required, 36 in single user mode, 385 recursive permission changes, 301 automating, 418–424 boot volume, mounted position, 59 symbolic mode, 299–300 with AppleScript, 422–423 bracket expressions in grep, 187 chown (change owner) command, combining commands, 420–421 brackets ([ ]) as wildcards, 193–194 296–298 creating double-clickable BrickHouse, 358 overview, 298 command files, 421–422 buffer in Terminal chsh command, 13, 406 with cron, 418–420 clearing, 151 classes completion, 136–138 printing, 258 in grep, 187 grouping, 39 settings, 17–19, 18 in tr command, 220–221 listing all, 138 builtin man page, 46 Classic Environment, 155 options for, 37–38 bunzip2 command, 266 open command for applications, 155 parts, 35 overview, 266 starting and stopping from command piping results to pager, 210 byte count, from wc command, 211, 212 line, 373 printing results, 255 .bz2 file extension, 265 clearing command history, 148–149 running single remotely, 324–325 bzgrep command, 185 cloning, startup volume, for Mac OS X file shell processing of, 11–12 bzip2 command, 265–266 system, 124–127 syntax, 4, 35–39 overview, 266 Close Window alert, 16, 16 .term files to run, 33–34 without options, 35–36

4354indx.fm Page 429 Wednesday, October 20, 2004 10:58 AM

COMMON UNIX PRINTING SYSTEM (CUPS) • DO SHELL SCRIPT COMMAND 429

Common Unix Printing System (CUPS), cursor ditto command to copy, 119–123 245 display settings, 19–20 execute permission for, 302 web browser interface, 256–257 moving in command line, 17 hierarchy of, 58 compiling AppleScripts, 422 cut and paste in Pico, 228, 230 limiting users to commands in specific, complete-ignore-case variable (bash), 136 316 complete variable (tsch), 136 D in Mac OS X home directory, 161, compress command, 269 dash (-) in file names, 51 162 compressed archives, finding text in, 185 data fork, 98, 395 moving, 104–105 compressed files, 261–262 database names, 50–51 with bzip2 command, 265–266 for locate command, 168–169 open command for, 154 decompressing, 266 periodic weekly command to opening current working in Finder, 81 decompressing, with gunzip, 264 create and update, 387 permissions, 303, 303–304 disk images, 272–273 for whatis command, building, 42 reading contents, 4–5 with gzip, 262–265 decompressing sticky bit, 304 using wildcards with commands, 267 disk images, 273 synchronizing, 123, 329–332 variations, 262 zip archives, 264 for .term files, 32 concatenating files, 201–202 default shell, 13 in Unix file system, 60 Connect to server dialog, 30, 30 opening in new window, 26 viewing contents. See ls (list directory) control characters, 50 deleting command copy and paste in Terminal, 31 directories, 107–108 dirs command, 85 copying. See also cp (copy) command files and directories, 7–8 overview, 86 applications with ditto, 120–121 groups, 293 disk images for archives, 270–275 directories with ditto, 119–123 user accounts, 284–285 compressing and uncompressing, files across network, 326–328 Desktop, 161 272–273 Courier font for Terminal display, 20 Developer Tools, 394–399 creating from directory, 272 cp (copy) command, 99–104 command-line interface, 394–395 Internet-enabled, 275 and changing file name, 101–102 CpMac command, 98, 119, 394, mounting and unmounting, 272 to copy directories, 102 395–396 sparse, 271 overview, 102 GetFileInfo command, 394, 397–398 , 270, 380 and resource forks, 103–104 MvMac command, 395, 396 to create , 272 and resources, 98 SetFile command, 395, 398 Repair Disk Permissions tool, 294 with wildcards, 99–101 symbolic links to, 118 DiskImageMounter, 270 CpMac (copy file) command, Xcode, 49 disks 98, 119, 394, 395–396 device mode for bless command, 386 du command for information on CPU usage, as part of , df command, free space information from, usage, 378–379 363 379–380 repairing crash logs, 377 diff command, 218–219, 219 diskutil tool for, 382 creation date for files, setting, 399 dig command, 348–349 fsck command for, 384–386 creator code for files, setting, 398 Digital Equipment Corporation, VT100 disktool command, 384 cron, 418–420 , 10 diskutil tool, 380–384 periodic command as task, 387 dimensions of Terminal windows, 23 for disk information, 381 .cshdirs file, for tcsh shell, 405 directories. See also folders list of options, 380, 383 CUPS (Common Unix Printing System), . (dot) and .. (dot dot) files in, 79, 81 for mounted disks list, 381–382 245 changing for ftp, 339 overview, 384 web browser interface, 256–257 changing name, 104 display settings in Terminal, 19, 19–21 cupsd process, 361 for command completion, 137 ditto command, 119–123 curl command, 332–336 comparing, 218–219 for applications, 120–121 overview, 333 copying all files, 101 for backups, 121–122 current directory cp (copy) command for, 102 to clone Mac OS X startup volume, as basis for relative paths, 54 creating, 5–6, 105–107 125–127 opening in Finder, 154 creating disk image from, 272 overview, 123 period (.) for, 7 deleting, 7–8, 107–108 sudo command with, 120 in Terminal prompt, 2 with rm command, 110–112 do shell script command, 422

4354indx.fm Page 430 Wednesday, October 20, 2004 10:58 AM

430 DOCK • FILE SHARING CONTROL PANEL

Dock uniq command to remove repeated configuring user access to sudo, 311 opening windows from, 27 lines, 215–217 default, 315 running commands from, 27 overview, 217 user aliases, 315–316 Terminal icon on, 10 vi (text editor), 233, 233–242, 235, /etc/xinetd.d/telnet file, 327 Dock menu, for selecting window, 29 236 ex mode in vi, 235 Documents folder, 161 overview, 240–241 exclamation point (!), as shortcut for domain information, from whois command, replacing text, 241–242 commands, 144 351–352 searching for text, 238–239, 239 executables, in ls listing, 64 dot (.) wc (word count) command, 211–213 execute permission, 295, 296 for current directory, 7 overview, 213 for directories, 302 as initial directory file, 79, 81 EDITOR variable (bash), 146 exit command, 310 leading, in file names, 53, 64 EDITOR variable (tcsh), 234 setting options, 15 dot dot (..), as initial directory file, 79 egrep (extended grep) command, 185 exiting shell, settings for, 15 double-clickable command files, creating, eliza, 243 export command, for environment variables 421–422 Emacs (editor macros), 242, 242–243 in bash session, 410 downloading data with curl command, graphical version, 227 extensions, report on, 377 332–336 overview, 243 overview, 333 emacs key-binding mode, 151 F drag and drop emulation settings, 16, 16–17 fc command (bash), 145–146 for copying, 122 environment variables FCEDIT variable (bash), 146 text to and from Terminal window, 21 for bash shell, 406–410 fgrep (fixed grep) command, 190 drivers for printers, 245 setting temporarily, 413 file command, 67, 199–201 du command, disk usage information from, for tcsh shell, 410–412 overview, 201 378–379 eraseDisk option for diskutil, risk, 382 file management eraseVolume option for diskutil, risk, 382 aliases and links, 112–118 E error messages command line advantages, 98 e-mail “Command not found”, 50 cp (copy) command, 99–104 for failed attempts to use sudo, 317 “error - no default destination and changing file name, text-based program, 335–336 available”, 246 101–102 echo command, 3 “Files: Directory not empty”, 107 to copy directories, 102 to test wildcards, 195 “NetInfo Error”, 279 overview, 102 to write text to file, 6–7 “No such file or directory”, 50, 76 and resource forks, 103–104 Edit menu in Terminal, 31 “Permission denied”, 122, 171, 307 with wildcards, 99–101 editing text, 211 getting rid of, 172 with Finder, 97, 97 diff command, 218–219, 219 piping and, 94 mkdir command, 105–107 Emacs (editor macros), 242, redirecting, 91–92 overview, 106–107 242–243 sending to “bit-bucket” directory, 172 mv (move) command, 104–105 overview, 243 “unable to print file: overview, 105 fmt command to format files, client-error-bad-request”, 246 and resources, 98 221–223 “error - no default destination available” organization, 161, 162 overview, 222 error message, 246 rm command, 108–112 Pico (pine composer), 226–231, 228, escaping overview, 111 229 control characters, 50 rmdir command, 107–108 creating files, 231 wildcards, 196–197 overview, 107 sed command, 223–225 /etc/bashrc file, 403 File menu, 29, 29–30  overview, 225 /etc/crontab file, 418 Get Info, 62, 63, 302  sort command, 213–215 /etc/csh.cshrc file, for tcsh shell, 404, 405 Make Alias, 10  overview, 215 /etc/csh.login file, for tcsh shell, 404, 405 New Command, 26  text editors /etc/passwd file, 286–287 New Shell, 26  basics, 225–226 /etc/profile file, for bash shell, 402 Print, 257–258  setting default, 234 /etc/sudoers file, 306 Show Info, 13 tr (translate character) command to available options, 313–314 making .term files available in, 32 replace characters, 219–221, 220 configuring, 313–317 File Sharing control panel, 278 4354indx.fm Page 431 Wednesday, October 20, 2004 10:58 AM

FILE SIZE • HASH COMMAND (BASH) 431

file size, ls command to display, 69 information display for results, fsck command, 384–386 “FILE SYSTEM WAS MODIFIED” 177–178 overview, 385 message, from fsck command, 385 with locate, 166–170 file transfer with ftp, 336–341 by name, 170–171 G available commands, 339 -newerXY argument, 175 Geneva font, for Terminal display, 20 changing directories, 337–338 overview, 179–180 get command (ftp), 338 ending session, 340–341 primaries for, 38 GetFileInfo command, 394 get command, 338 by size, 175–176 Gimp-Print, 245 mget command, 339 text in man pages, 46–47 globbing, 192 mput command, 338 by type, 173–174 GLTerm, 34 opening session, 336–337 using logical operators, 178–179 GNU Mac OS X Public Archie, 336 overview, 340 using wildcards, 171–173 graphical applications put command, 338 with whatis, whereis, and which, opening on remote Mac, 323 file types, 295–296 169–170 text editors, 227 command to return, 199–200 Finder graphics files, removing thumbnail images listing, 199 copying, vs. ditto command, 122 from, 103 setting, 399 Defense Department-approved grep command, 180–187 filenames, 50–51 deletion system, 110 character classes, 187 completion, 130–135 directories hidden by, 164–165 curl command with, 334–335 case sensitivity, 131 Find dialog, 162, 163 and Mac OS X file system, 183 displaying options, 134–135 Force Quit dialog, 372 overview, 191 for similar names, 132–133 opening directories in, 154 pipe with, 92 turning off case sensitivity, 133 current working directory, 81 ps command with, 370 variables overview, 136 and permissions, 302–304, 303 saving results to file, 184–185 files. See also permissions; saving; text files for saving time in Terminal, 77, 77 to search for 2 strings, 184 appending command output to, 89 user folder display, 58, 63 searching for character patterns, comparing, 218–219 view of mounted volumes, 83 185–186 compressed, 261–262 finding text top command with, 367–368 copying across network, 326–328 in compressed archives, 185 group ID numbers creating, 6 in Pico, 230 listing, 289–291 default permissions for new, 297 and replacing ls results, 71–72 deleting, 7–8 in sed, 224 grouping commands, 39 finding. See also find command with tr, 219–221 groups, 288–293 contents with grep, 180–187 in vi, 241, 241–242 adding users to, 292 GetFileInfo command to return in vi, 238–239, 239 creating, 289–291 attributes, 397–398 finger command, for user information, 352 deleting, 293 ls information display, 72 firewall (ipfw), 355–358 finding files by ownership, 176 open command for, 156–157 rules, 356–358 removing users from, 292 using application different from fixed-width font, 20 for user account, 281, 283 default, 157–158 flags (options) for commands, 35, 37–38 groups command, overview, 288 ownership, changing, 296–298 fmt command, 221–223 gunzip command, 264 protecting from overwriting, 90 overview, 222 overview, 265 sharing with group, 288 folder mode for bless command, 386 Gutenberg.com FTP server, 334 synchronizing, 329–332 folders. See directories .gz archives, finding text in, 185 writing text to, 6–7 Font dialog, 20 .gz file extension, 263 “Files: Directory not empty” error message, font for Terminal display, 20–21 gzip command, 264 107 Font menu in Terminal, 32 overview, 265 find command, 161–166 frameworks, report on, 377 H belonging to no user or group, 176 free memory, 363 halt command, 393 belonging to specific user or group, free space, df command for information on, hard links, 115–116 176 379–380 properties and usage, 117 by date, 174 FreeBSD Unix , 278 Hard Reset (File menu), 30 gluing multiple options, 176–177 frozen computer, troubleshooting, 372 hash command (bash), 424 4354indx.fm Page 432 Wednesday, October 20, 2004 10:58 AM

432 HDIUTIL TOOL • LS (LIST DIRECTORY) COMMAND

hdiutil tool, 270–275 get command, 338 ln (link) command, 113–116 to and unmount disk image, mget command, 339 overview, 118 272 mput command, 338 load avg, as part of system information, 363 overview, 274–275 opening session, 336–337 locate command, 36, 166–170 head command, 203–205 overview, 340 counting results from, 167 overview, 205 put command, 338 database for, 168–169 help in Terminal, 41–49. See also man pages Internet-enabled disk images, 275 periodic weekly command to with whatis command, 41–42 Internet Printing Protocol (IPP), 245 create and update, 387 HFS+ file system, Finder flags, 397 invisible files log in to server, .term files for, 34 hidden directories, opening in Finder, 154 . (dot) for, 53 logging in .hidden file, 165–166 backups, 124–125 as another user, 310 hidden files, displaying, 63 including in Find, 163, 164 to remote computer hier man page, 60 ipfw firewall, 355–358 with ssh, 322–325 hierarchy of Mac OS X file system, 58 overview, 359 with telnet, 325–328 HISTCONTROL variable (bash), 147 rules, 356–358 logical operators, with find command, history command, overview, 150 third-party management tools, 358 178–179 .history file (tsch), 147–148, 405 IPP (Internet Printing Protocol), 245 login command, 310 HISTSIZE variable (bash), 147 iTerm, 34 .login file, for tcsh shell, 405 home (~) directory, 4, 58, 278 login shell, vs. non-login, 403 cd command to return to, 78 J logout command, setting options, 15 Home icon, 4 job number for print jobs, 253 logs host command, 349 jobs command, 37 report on, 377 HTML page, saving man pages as, 48 K of sudo uses, 307 tail command to view, 205 I kernel panic, 384 wc command to count items, 212 ICMP ECHO_REQUEST packets, ping key bindings, 47–48, 150 lossless compression, 261 command to send, 346 key mappings, 24 lossy compression, 261 id command, 288 keyboard lp (line print) command, 246–250 overview, 289 settings for, 17, 24 media size, type, and source, 248–249 ifconfig (interface configure) command, to switch Terminal windows, 28–29 multiple copies, 247–248 342–343 keyboard shortcuts in Terminal, 150–152 orientation, 250–251 overview, 342 arrow key shortcuts, 150 overview, 251 Impasse, 358 for less command, 209 selected pages, 248 inactive memory, 363 kill command, 323, 370, 371–373 to specific printer, 251 info mode for bless command, 386 overview, 373 lpadmin command, 255 input signals, 372–373 lpinfo command, 255 emulation settings, 16–17 killall command, 372 lpoptions command, 255 redirecting, 89–90 L lpq command, 252 with pbcopy and pbpaste, 93–94 overview, 253 landscape orientation for printing, 250 input redirection operator (<), 89–90 lpstat command, 249–250, 251 less command, 45, 206–209 insert mode in vi, 235, 237 ls (list directory) command, 5, 37–38, overview, 208 command, 389–391 62–75 shortcuts for, 209 overview, 390 complete directory contents, 63–64 Library (File menu), 30 Intego Personal Backup, 124 with file names containing , 51 Library folder, 161 interactive mode, for rm command, 7, file size display, 69 line breaks 108–109 with ftp, 337 converting for less command, 208 Internet, 319 long information display, 65–68 converting Macintosh to Unix, 220 curl command for downloading data, output in color, 73 grep command and, 183 332–336 overview, 74 lines of text overview, 333 precise time information display, 70 removing repeated, 215–217 file transfer with ftp, 336–341 saving result to text file, 75 wc command to count, 211, 212 available commands, 339 several files information display, wrapping in Terminal, 18–19 changing directories, 337–338 72–73 Links, 336 ending session, 340–341 single file information display, 72 4354indx.fm Page 433 Wednesday, October 20, 2004 10:58 AM

LYNX • OPEN COMMAND 433

sorting MemRegions, as part of system infor- logon alphabetically, 68 mation, 363 with ssh, 322–325 by size, 69 Message of the Day, 2 with Telnet, 325–328 by time modified, 70 metadata mounting remote volumes, 320–321 user and group ID numbers display, CpMac command and, 395 AppleShare volume, 320–321 71–72 ditto command to copy, 119 iDisk, 321 viewing specific directory, 64–65 MvMac command and, 396 Samba volume, 321 Lynx, 336 mget command (ftp), 339 opening graphical applications Micromat Tech Tool, 386 remotely, 323 M Microsoft Word, open port, 354 report on, 376 Mac OS X 10.3 (Panther), 13 mkdir command, 5, 105–107 scp to copy files remotely, 326–328 CUPS and shadowhash passwords, overview, 106–107 synchronizing files and directories, 256–257 modal editor, vi as, 235 329–332 Mac OS X file system, 58–60 modification time network utilities, 341–354 cd command, 5–6, 8, 38–39, 75–86 preserving when copying file, finger for user information, 352 file command to list contents, 67 101–102 ifconfig for getting information, grep command and, 183 setting, 399 342–343 ls command. See ls (list directory) Monaco font, for Terminal display, 20 overview, 342 command more command, vs. less, 206 netstat, 343–345 moving to other volumes, 82–83 mount command, 322 to check for open ports, vs. other Unix systems, 286–287 for disk images, 272 353–354 pushd and popd to jump around, for remote AppleShare volume, overview, 345 83–85 320–321 nslookup, 347–349 pwd for current location, 60–62 for Samba volume, 321 overview, 349 to resolve symbolic links, 62 mounted disks, diskutil for listing, ping, 346–347, 347 report on, 376 381–382 stroke for scanning ports, 353–354 startup volume, cloning, 124–127 mountpoints, backups and, 125 traceroute, 350 mach_kernel, backup, 125 moving cursor in command line, 17 whois, 351–352 maintenance. See system maintenance moving through man pages, 45–46 , 341, 341 man command, 44 MP3 files, compression, 261 Neuberg, Matt, 365 overview, 47 .mpkg files, installing, 390–391 newlines, as carriage returns, 17 man pages, 43–49 mput command (ftp), 338 NeXTStep, 278 for command syntax, 39 multiple copies, printing, 247–248 nidump command, 290 finding text in, 46–47 Multiple Users control panel, 278 overview, 292 hier, 60 multitasking, preemptive, 361 niload command, 280–281 man directory contents, 43 mv (move) command, 104–105 overview, 286 moving through, 45–46 overview, 105 nireport command, 289 overview, 47–48 and resources, 98 overview, 291 printing, 259 MvMac command, 98, 395, 396 Nisus Writer, PowerFind, 185 for shell, 402 “No such file or directory” error message, quitting display of, 46 N 50, 76 reading, 44–45 NetInfo database noclobber variable, 90, 408 saving backup and restore, 282–283 non-login shell, vs. login, 403 for shell, 402 removing group from, 293 normal user accounts, 278 as text files, 48 “NetInfo Error” error message, 279 not (\!) operator, for find command, 177 tools for viewing, 48–49 NetInfo Manager nslookup (name server lookup command), managed accounts, 278 to activate root user, 311 347–349 ManOpen, 49 to create user account, 279 overview, 349 media size, when printing, 248–249 netstat (network status) command, numbering lines, in cat command, 202 memory leaks 343–345 nvram (non-volatile RAM) command, 393 kill command to stop, 372 to check for open ports, 353–354 and swap files, 365 overview, 345 O memory, report on, 376 network connections open command, 6–7, 81, 154–159 MemoryStick, 365 backups across, 123 for applications, 155–156 4354indx.fm Page 434 Wednesday, October 20, 2004 10:58 AM

434 OPENING .TERM FILE • PUSHD COMMAND

for directories, 154 paths scanning with stroke command, for files, 156–157 absolute vs. relative, 53–55 353–354 for files using application different for symbolic links, 114 for ssh, 323 from default, 157–158 command to determine, 13 for Telnet, 326 overview, 159 for ls command, 65 portrait orientation for printing, 250 for URLs, 158–159 pbcopy command, 93–94 Power Manager set (pmset) command, 393 opening .term file, 32–33 pbpaste command, 93–94 pr command, 252 as meta key, 24 PDF files preemptive multitasking, 361 options for commands, 35, 37–38 printing more quickly, 247 primaries, 38 orientation of printing, 250 saving man pages as, 402 Print Center utility, 245 osascript command, 422 performance, typing and, 129 printer, getting information about, 249–250 overview, 423 period (.). See dot (.) printing, 245 output periodic command, 282, 308, 418–419 cancel command, 253–254 appending to file, 89 for system maintenance, 387–388, overview, 254 emulation settings, 16–17 388 command line to manage, 255 redirecting, 88–89 “Permission denied” error message, 122, with lp (line print) command, with pbcopy and pbpaste, 93–94 171, 307 246–250 to two places with tee, 94 getting rid of, 172 media size, type, and source, output redirection operator (>), 75, 89 permissions, 293–296, 295 248–249 overwriting existing files changing, 298–301 multiple copies, 247–248 with cp command, 100 with absolute mode, 300–301 orientation, 250–251 preventing, 408–409 with symbolic mode, 299–300 overview, 251 default for new files, 297 selected pages, 248 P file types, 295–296 to specific printer, 251 paged memory, 363 Finder and, 302–304, 303 in Terminal, 255 pageins statistics, 364 ls command to display, 293 lpq to check queue, 252 pageouts statistics, 364 preserving in backups, 124 overview, 253 pagers, 206 recursive changes, 301 man pages, 259 piping data to, 210 repairing on startup volume, 382 for shell, 402 pages solving problems, 294 from Terminal, 255–259 formatting text in, 252 types, 296 Print menu, 257, 257–258, 258 presenting text by, 45 physical memory, use of, 363 privileges. See permissions selecting to print, 248 PhysMem, as part of system information, 363 processes, 361 Panther (Mac OS X 10.3), 13 Pico (pine composer), 226–231, 228, 229, displaying running, 15, 15–16 CUPS and shadowhash passwords, 308 killing all, 372 256–257 creating files, 231 monitoring single, 367–368 parent directory (..), 8, 55 saving files, 230 name in Terminal title bar, 24 moving to, 81 setting as default editor, 234 quitting from command line, 370, opening in Finder, 154 Pine (e-mail program), 336 371–373 partitions, 382 ping, 346–347, 347 sorting in top by CPU usage, 365 passwords pipes total, as part of system information, administrator, for Mac OS X startup for commands, 35 362 volume cloning, 126 with grep command, 184 .profile file, bash shell use of, 403 for mounting shared Windows folder, with lp (line print) command, 255 ProjectBuilder, 49 321 redirecting with, 92–93 prompt character ($), 2 for root user, 279 and error messages, 94 prompt in Terminal window, 2–3 for sudo command, 307 pmset (Power Manager set) command, 393 vs. pwd display, 61 for Telnet, 326 popd command, 83–85 ps (process status) command, 368–370, 370 for user account, 281 overview, 86 with grep command, 370 passwrd file, 280 silencing, 85 overview, 371 path variable, and command completion, 137 port Public folder, 161 PATH variable netstat to check for open, 353–354 pushd command, 83–85 for bash shell, 402, 410 opened by applications, 355 overview, 86 for tcsh shell, 405, 412 silencing, 85 4354indx.fm Page 435 Wednesday, October 20, 2004 10:58 AM

PUSHDSILENT SHELL VARIABLE • SHREDDING FILES 435

pushdsilent shell variable, in tsch shell, 85 replacing text. See finding text, and replacing for firewall rule configuration, 358 put command (ftp), 338 Reset (File menu), 30 scrollback in Terminal, 18 pwd (print working directory) command, resource forks, 98 printing, 258 60–62 backup, 125 Scrollback menu in Terminal, 31 overview, 61 compressing files with, 264 searches. See find command; grep command to resolve symbolic links, 62 and cp (copy) command, 103–104 Secure Keyboard Entry (File menu), 30 CpMac command and, 395 security Q MvMac command and, 396 ipfw firewall, 355–358 question mark (?), as wildcard, 193 resources, ditto command to copy, 119 rules, 356–358 quitting processes from command line, 370, restoring NetInfo database, 282–283 overwriting file space, 110 371–373 reverse search prompt in bash, 145–146 sed command, 223–225 quotes, for filenames with special characters, reverse sort order, 214 overview, 225 196–197 rm command, 7, 108–112 Send Break (File menu), 30 R alias as safety net for, 415 sessions, 3 overview, 111 set command, 406–409 read-only privileges, default setting for wildcards with, 195 Set Title (File menu), 30 group, 288 rman command, 48 setenv command, 410–411 read permission, 295, 296 rmdir command, 107–108 SetFile command, 395, 398 reading overview, 107 sftp command, 341 directory contents, 4–5 root of file system, 58 shadowhash passwords, CUPS and, man pages, 44–45 root user, 278, 279, 306 256–257 reboot command, 393 enabling account, 311 Shared directory, 288 recovery of deleted files, 108 sudo command to become, 309 SharedLibs, as part of system information, recursive ownership changes, 298 routing tables, 344–345 363 redirecting rsync command, 123, 329–332 Sharing , Firewall tab, 355, error messages, 91–92 overview, 331 355 input, 89–90 Run Command dialog, 27 shebang, 424 with pbcopy and pbpaste, 93–94 Run Command inside a Shell, 26–27 shell, 9, 10–11. See also bash shell; tcsh shell input and output, 90–91 command processing, 11–12 output, 88–89 S configuring, 401, 406–416 with pbcopy and pbpaste, 93–94 , and swap files, 365 environment variables for bash, to two places with tee, 94 Samba volume, mounting from command 406–410 with pipes, 92–93 line, 321 before Jaguar, 404 redirection symbols Save (File menu), 30 default, 13 > (output redirection operator), 75 savehist variable (tsch), 147–148 exiting, settings for, 15 for commands, 35 saving login vs. non-login, 403 reference file, for comparing file modifi- grep results to file, 184–185 name in Terminal title bar, 24 cation date, 174 ls results to text file, 75 saving or printing man page for, 402 regular expressions, 192 Mac OS process, 98 for scripting, 424 in apropos command, 41 man pages using different, 406 in grep, 185–186 for shell, 402 shell aliases, 414–416 examples, 186–190 as text files, 48 shell scripts, 423–424 rehash command (tcsh), 424 output of top command, 367 shell variables, 410 relative paths, 53–55 part of file to different file, 204 setting, 412–414 for cd command, 77 in Pico, 230–231 for session, 85 for symbolic links, vs. absolute paths, system_profiler report, 377 temporarily, 413 114 .term files, 32 shopt command, 406, 409–410 remote login schedule for automatic commands. See shortcuts with ssh, 322–325 periodic command for less command, 209 with telnet, 325–328 scp (secure copy) command, 326–328, 389 for substituting arguments, 140 See removing. deleting overview, 328 with sudo, 142 repairing disks screencapture command, 393 show-all-if-ambiguous variable (bash), 136 diskutil tool for, 382 scripts Show Info (File menu), 30 fsck command for, 384–386 for adding users and groups, 293 shredding files, 110 4354indx.fm Page 436 Wednesday, October 20, 2004 10:58 AM

436 SHUTDOWN COMMAND • TERMINAL

shutdown command, 393 StuffIt Expander, 261 System Profiler, 375 shutdown process, for bash shell, 404 su command, 310 system_profiler command SIGTERM signal, 371 sudo (substitute-user do) command, 42, overview, 377 simplified accounts, 278 142, 172, 279, 306–317 system information from, 375–377 single user mode, booting Mac in, 385 to access system files, 230 Sites folder, 161 available commands for, 311 T size of font for Terminal display, 20–21, 32 with ditto, 120 Tab key, for filename completion, size of Terminal windows, 23 to edit system files, 308–309 130–131, 132 for man pages, 46 limitations, 309 tail command, 204, 205–206 slash (/), 50 overview, 312 overview, 206 in ls listing, 64 running as different user, 312 tar command, 264, 267–269 software, updating and installing, 389–393 timeout configuration, 316 overview, 269 softwareupdate command, 391–393 when to use, 307–309 tarball, 268 overview, 392 sunShield, 358 tcpdump command, 356 sort command, 213–215 swap file, 363, 365 tcsh shell, 13, 401 overview, 215 switches (options) for commands, 35, % prompt, 2 sorting 37–38 cdpath variable, 81 ls results switching windows in Terminal, 27–28 command completion, 136–138 alphabetically, 68 from keyboard, 28–29 command history, 138 by size, 69 symbolic links, 68, 112–118 completion autolist in, 135 by time modified, 70 absolute vs. relative paths for, 114 downloading PDF manual for, 402 processes in top by CPU usage, 365 backups and, 125 EDITOR variable, 234 spaces in file names, 50, 51 vs. hard links, 116 environment variables, 410–412 sparse disk images, 271 ln (link) command to create, escaping non-ASCII characters, 17 .sparseimage file extension, 271 113–116 information about, 151 special characters properties and usage, 117 noclobber variable, 90 replacing or deleting, 220 pwd to resolve, 62 savehist variable, 147–148 in Unix, 51–52 symbolic mode for chmod command, 299 setting default editor, 234 .spx file extension, 377 changing permissions, 299–300 startup process, 404–405 ssh command, 389 and sticky bit, 304 turning off case sensitivity for filename overview, 324 synchronizing files and directories, completion, 133 for remote secure logon, 322–325 329–332 .tcshrc file, 405 running single commands remotely, system files, sudo command to edit, 230, # symbol for comments, 411 324–325 308–309 set autolist command, 135 standard output, writing argument to, 3 System Folder settings for ls command color display, 73 startup process backup, 124 shell aliases in, 414 for bash shell, 402–403 bless command for, 386–387 tee command, 94 for tcsh shell, 404–405 system information, 375–380 overview, 95 startup volume for Mac OS X file system ps command for, 368–370, 370 Telnet cloning, 124–127 system_profiler for, 375–377 enabling, 327 repairing permissions, 382 top command for, 362, 362–368 overview, 325 stderr (standard error), 88 system maintenance remote login with, 325–328 redirecting to file, 91–92 df command for free space infor- .term files, 23, 32–33 stdn (standard input), 88 mation, 379–380 name in Terminal title bar, 24 stdout (standard output), 88 du command for disk usage infor- opening when starting Terminal, 25 sticky bit for directories, 304 mation, 378–379 to run commands, 33–34 strings, finding. See grep command importance of, 388 Terminal stroke, for scanning ports, 353–354 periodic command for, 387–388, 388 case sensitivity in, 131 stuff command, 269 system_profiler for system infor- clearing buffer, 151 StuffIt compression, and resource forks, mation, 375–377 creating new directory, 5–6 264 , Accounts pane, 279, creating new file, 6 StuffIt Deluxe, 269 280, 285 deleting files and directories, 7–8 4354indx.fm Page 437 Wednesday, October 20, 2004 10:58 AM

TERMINAL INSPECTOR • USERS 437

Finder for saving time in, 77, 77 setting default, 234 typing getting help, 41–49. See also man pages vi (text editor), 233, 233–242, 235, corrections on the fly, 152 with whatis command, 41–42 236 speed of, 129 icon, 2 overview, 240–241 interaction with other operating replacing text, 241–242 U system parts, 11 searching for text, 238–239, 239 umask value, 297 keyboard shortcuts, 150–152 text files umount command, 320–321 multiple windows, 27–29 changing length of line, 221–223 “unable to print file: switching between, 27–28 saving ls results to, 75 client-error-bad-request” error message, switching from keyboard, 28–29 saving man pages as, 48 246 window title changes on the fly, 28 TextEdit, 227 unalias command, 416 opening, 1–3 setting as default editor, 234 underline cursor, 19 printing from, 255–259, 257, 258 TextEdit Plus, 227 underscore (_), in file names, 52 with lp (line print) command, TextWrangler, 227 Unicode characters, escaping non-ASCII 255 thumbnail images, removing from graphics characters, 17 quick access, 10 file, 103 uniq command reading directory contents, 4–5 tilde (~) to remove repeated lines, 215–217 replacement programs for, 34 in file names, 51 overview, 217 setting up, 12–24 for navigation shortcuts, 78 Unix customizing settings, 13–14 time, ls precise information display, 70 directories in, 60 typing first command, 3–8 time stamp, for compressed files, 263 hard links, 115–116 what it is, 9–12 title bar of Terminal windows, 23–24, 29 vs. Mac OS X, 286–287 window, 2, 13 window title changes on the fly, 28 network connections, 319 as wrapper for shell, 10 top command, 323, 362, 362–368, 368 special characters in, 51–52 writing text to file, 6–7 displaying full process information, unmounting disk images, 272 Terminal Inspector, 14 367 unstuff command, 269 Buffer settings, 17–19, 18 with grep command, 367–368 unzip command, 156, 264 Color settings, 22, 22 overview, 369 updating Mac OS X, 391–393 Display settings, 19, 19–21 sorting by CPU usage, 365 uploading files with ftp, 338 Emulation settings, 16, 16–17 update interval, 366–367 uppercase characters, converting to low- Keyboard settings, 24, 25 touch command, 6, 174 ercase, 219 Process settings, 15, 15–16 tr (translate character) command, 183, URLs Shell settings, 14, 14–15 219–221, 220 for CUPS interface, 245 Windows settings, 23, 23–24 traceroute, 350 downloading from, 332–336 Terminal menu transparency for Terminal window, 22 for mounting remote AppleShare >> Preferences, 24 Trash volume, 320 >> Window Settings, 13 alias to move files to, 415 open command for, 158–159 Terminal Preferences dialog, 24–25, 25 difficulty emptying, 112 used memory, 363 terminals, 9–10 removing files to, 109 user aliases, in /etc/sudoers file, 315–316 text-based browser, 335–336 Trojan horses, port use by, 354 user ID numbers text, display settings, 20–21 troubleshooting ls results, 71–72 text editors frozen computer, 372 selecting, 284 basics, 225–226 hardware, 375 user name, in Terminal prompt, 2 Emacs (editor macros), 242, TruBlueEnvironment, 373 users, 277–279 242–243 tsch shell account creation, 279–287 overview, 243 command history, 85 from command line, 280–281 graphical, 227 path in prompt, 61 account types, 278–279 to open .term files, 33 pushdsilent shell variable, 85 adding to groups, 292 opening commands in, 146 shutdown process, 405 changing short username, 285 Pico (pine composer), 226–231, TTY devices, settings, 14–15 crontab file for, 420 228, 229 type command, 415 deleting accounts, 284–285 creating files, 231 determining those logged in, 287 4354indx.fm Page 438 Wednesday, October 20, 2004 10:58 AM

438 USERS COMMAND • ZSH SHELL

finding files by ownership, 176 W escaping, 196–197 logging in as another, 310 w command, 287 for finding files, 171–173 on network, information about, 352 wc (word count) command, 92, 167, and globbing, 192–197 removing from group, 292 211–213 in grep, 185–186 running sudo as different, 312 overview, 213 for lp command, 246 users command, 287 web browser with open command, 156 /usr/share/man directory, 43 for printer management, 256–257 summary, 197 V text-based, 335–336 testing, 195 web sites Window menu, 28 /var/crondirectory, 420 for AppleScript, 423 windows /var/vm directory, 365 for downloading tcsh manual in PDF multiple in Terminal, 27–29 variables. See also environment variables; shell format, 402 switching between, 27–28 variables on error messages when repairing per- switching from keyboard, 28–29 setting temporarily, 413 missions, 294 window title changes on the fly, vertical bar cursor, 20 for Gimp-Print, 245 28 vi key-binding mode, 151 GNU Mac OS X Public Archie, 336 size for man pages, 46 vi (text editor), 233, 233–242, 235, 236 for graphical text editors, 227 Windows shared folder, mounting from opening file from less command, 207 for Pico text editor, 226 command line, 321 overview, 240–241 for shell scripts, for adding users and wired memory, 363 replacing text, 241–242 groups, 293 word count, from wc command, 211, 212 searching for text, 238–239, 239 for third-party ipfw management word wrap in Terminal, 18–19 viewing files, 199 tools, 358 write permission, 295, 296 with cat command, 201–203 whatis command, 41–42, 169–170 writing text to file, 6–7 file command to indicate file type, building database, 42 199–201 X overview, 42 head command for beginning, X11 package, rman command, 48 whereis command, 169–170 203–205 Xcode, 49 which command, 13, 169–170, 415 less command, 206–209 XML files who command, 287 vim (vi iMproved), 226 saving system_profiler report as, 377 whoami command, 35–36 virtual memory (VM), 363–364, 366 .term files as, 33–34 whois, 351–352 visudo command, 313 wide glyphs, for Terminal display, 21 VM (virtual memory), 363–364 Z wildcards, 50 vm_stat command, 366 zgrep command, 185 * (asterisk), 52, 192–193 volumes zip archives ? (question mark), 193 bless command for, 386–387 decompressing, 264 [ ] (brackets), 193–194 managing, 380–384 unzipping from command line, 156 { } characters, 194–195 moving to other, 82–83 Zip drive, for backups, 121 for commands to compress files, 267 zsh shell, escaping non-ASCII characters, 17 cp (copy) command with, 99–101