100 more things every Mac user should know: Terminal, Search and Automator

Macworld Staff
6 June, 2013
View more articles fromthe author

The penultimate part of our guide to 100 more things every Mac user should know, here we cover 82 to 94, some tips and tricks all related to Terminal, Search and Automator.


Customise your Terminal prompt

82 Open Terminal

When you open Terminal, you see 
the blinking cursor and, depending on your setup, your username, the current time, the current directory or other such information. But do you know how to customise that prompt? Here’s how.

In Terminal, type nano .bash_profile.

That’ll put you in the nano text editor; don’t panic. Now type export PS1=”", but between those quotation marks put your choice of the following switches:

\W The current directory

\w The current directory, with the full path

\h Your computer’s host name (that is, your computer’s network name)

\u Your username

\d The current date

\t The current time

Note that you can also add any spaces, colons, dashes and so on that you’d like to make the results look good.

When you’ve finished, press Control-X (to exit), then Y (to confirm that you want to save the file), and then press Return to exit back to the command line. When you restart Terminal, your newly customised prompt should be in place.


Seven Google search operators you should know

Smart searchers know they can narrow their searches by using Google search operators. (You can place most of these terms anywhere in your query; those beginning with all need to come at the beginning.)

83 filetype:

This search operator restricts the results to items of a specific filetype. Entering ‘puppies filetype:jpg’ will get you lots of puppy pictures.

84 intext/allintext:

Finds pages containing a specific string of text. For example, ‘Beatles breakup intext:Paul McCartney’ finds pages containing Paul’s name and the words Beatles, breakup or both.

The operator ‘allintext’ goes at the start of the search field and forces Google to return only those pages that contain all of the following search terms.

85 intitle/allintitle:

Similar to intext, this search operator searches for specified terms in the title of webpages.

86 inurl/allinurl:

This acts like intext and intitle, but works on URLs.

87 link:

This finds pages linked to the specified URL. ‘link:myblog.com’ will find pages linking to your blog.

88 related:

This search finds pages similar to the one you specify; ‘hamsters related:myblog.com’ should find other pages as obsessed with rodents are you are.

89 site:

This is perhaps the handiest, as it finds the search terms on a speci
fic website.


Five useful Automator workflows

90 Wrap selected text in quotes

Create a new Service workflow. In the header area, tell it to process selected text in any application. Click the Output replaces selected text checkbox. Drag the Run AppleScript action to the workflow, and enter the following:

on run {input, 

return “\”" & (input as string) & “\”"

end run

Save the finished workflow. Now when you select some text, and right- or Control-click it and choose Services, you should see your service. Click that, and the selected text should appear in quotes.

91 Get a word count

Create a new Service workflow and set it to process selected text in any application. Leave the ‘Output replaces selected text’ checkbox unchecked. Then add the ‘Run AppleScript’ action to the workflow, and enter:

on run {input, 

set theWordCount to count words of (input as string)

display dialog (theWordCount & ” words in the selected text.” as string)

end run

Save the workflow. Select some text, open the Services menu, and choose your service to get the word count.

90. Wrap selected text in quotation marks with this simple AppleScript.

92 Create a subfolder

Create a new Automator Service workflow and set it to process folders in Finder.

Add the ‘Set Value of Variable’ action to the workflow; from its pop-up menu, create a new variable, and name it folder. Add the New Folder action to the workflow. Enter the name subfolder, or something else.

Drag the folder variable from the Variable area to the Where pop-up. Finally, with the action selected, choose Action > Ignore Input from the menu bar. Save the workflow.

Your new service should now appear under Services. Select a folder, choose this service, and you should have your subfolder.

93 Add dates to files

Create a new Automator Service workflow and set it to process files in Finder. Drag the Rename Finder Items action to the workflow.

When Automator prompts you to insert a Copy Finder Items action, click Don’t Add. Configure the action to Add Date or Time.

Set the Date/Time to Current, the Format to Year Month Day, the Where to Before name, the first Separator to Dash, the second Separator to Space, and click the Use Leading Zeros checkbox.

Save the workflow. It’ll show up in Finder’s Services menu. Select a file or folder, then choose the service, and the date should be added.

94 Toggle hidden files

Create a new Automator Application workflow. Add the Run AppleScript action to your workflow, and enter the following:

if {“OFF”, “FALSE”}
contains (do shell
script “defaults read
AppleShowAllFiles”) then

set theValue to


set theValue to “FALSE”

end if

do shell script
(“defaults write com.
AppleShowAllFiles ” &
theValue) as string

do shell script
”killall Finder”

Save the workflow and then put it wherever you like. When you want to see hidden files, all you have to do is double-click it.

By Dan Frakes, Lex Friedman, Joe Kissell, Ted Landau, Steve McCabe, Dan Miller, Rich Mogull and Ben Waldie, Macworld

Leave a Comment

Please keep your comments friendly on the topic.

Contact us