The Mac Observer

Mac OS X: Time-Saving Terminal Tips

TMO Talk (26)

In this tip, we’re going to cover a few of my favorite time-savers for the Terminal, which lives in Applications > Utilities. I use Terminal almost every single day for one thing or another—it’s a great resource for troubleshooting problems, but it’s also an incredible program to help you understand more about what’s going on under the hood of your Mac.

I’m going to assume in this article that you guys have at least a passing familiarity with Terminal, so I may not go into a whole lot of detail about why you’d want to do certain things or what the terminology means. If you have any questions, though, feel free to ask in the comments, and either I’ll help you or one of our brilliant TMO members will. So let’s jump on in and get our feet wet, shall we? 

 

Command-Click the Title Bar

Just as in the Finder, you can hold down Command and click on the icon or the text in the title bar to get a hierarchical view of where you’ve navigated to in the file system. This, to me, is often faster than using pwd (present working directory), especially if I’m in the middle of something.

Save Windows as Group

If you often work with many windows at once, you can save their appearance, location, and even what directory they’ll open with, without you having to type in a gosh-darned thing afterward. To do this, enter and run the commands to change the windows to your preferred directories, adjust their size and location on your screen, and choose Window > Save Windows as Group.

After saving them out, you can invoke those windows either by choosing Window > Open Window Group or by setting them to launch when you start Terminal. Configure that by going to Terminal > Preferences > General and changing “On startup, open” to your new window group. You’re now a wizard, Harry.

Use Tab Completion

People who use the Terminal a lot live and die by Tab completion—I know it’s one of my favorite things ever. I like it more than I like coffee. 

Huh. So I really can lie with a straight face. 

Anyway, if you start typing the path to a folder, you can hit the Tab key to have Terminal fill in the rest for you.

Start typing, and then hit Tab…

 

…and you won’t have to type anymore. But why don’t I have an actual command in this image? Sigh.

 

If there aren’t any matches for what you’ve typed or if there’s more than one match, your Mac will make a complaining noise at you, and nothing will happen. If there is more than one match available, though, you can tap Tab again, and Terminal will show you your choices.

Drag Items from Finder

To quickly add the path to a file or a folder to a command, drag the item from the Finder and drop it onto your Terminal window. 

Paste Escaped Text

A quick explanation: If you’ve got a file or folder that has spaces or other special characters in its name (like “Old Photo of Mom!.jpg”), Terminal won’t understand what you’re asking it to do if you type in the filename exactly as it is. It assumes that a space should be interpreted as “move on to the next command or argument,” for example, which is obviously not what you’d want. To force Terminal to see the whole thing as a file name, you’ll have to escape those spaces and characters by adding in a backslash before each one, which’ll look like this:

Melissas-Laptop:~ melissa$ open /Users/melissa/Desktop/Old\ Photo\ of\ Mom\!.jpg

Typing that, however, can be a pain in the behind, so I always use Tab completion or dragging files in to avoid having to do it. What if you’ve copied the path from somewhere like Finder’s Go to Folder window, though? An easy way to save time is to paste it into Terminal by using the Edit > Paste Escaped Text menu item (or hit Control-Command-V).

That way, your path will be pasted in with the formatting already done. Let your Mac do the heavy lifting for you, I say. Just not literally.

Open the man Page or Related Pages

This one’s Lion-specific. What? You haven’t updated? For shame. Well, for the good little Apple fanboys and fangirls out there, what you can do in 10.7 is right- or Control-click on a command in the Terminal window and choose Open man Page from the contextual menu.

This, of course, takes the place of typing man [command] into Terminal when you’re looking to get instructional information. If you look in that same contextual menu, you’ll also see Search in man Pages, which is a simple way to look for commands relating to what you’re trying to do (it’s equivalent to doing apropos [keyword], for you Terminal junkies).

I’m sure this is apropos of something. Har har.

 

So now that we’ve walked through all of this, do you feel Terminal-ed out? I don’t. I’m ready to run a Terminal marathon! Look for all the man pages! Sudo all the things! Or maybe I’m ready to just go lie down and calm myself.

Post A Comment or Log-in. Need an account? Register here.

9 Observer Comments

You’re welcome, John! big grin

You can do lots of clever and useful things with Terminal, but you can do plenty of damage, too, with a simple typing error. Also, it’s not easy for the casual user to keep up with all the terminal commands ands their parameteres. A safer and easier option is provided for free by Clix: http://rixstep.com/4/0/clix/

You can do lots of clever and useful things with Terminal, but you can do plenty of damage, too, with a simple typing error. Also, it’s not easy for the casual user to keep up with all the terminal commands ands their parameteres. A safer and easier option is provided for free by Clix: http://rixstep.com/4/0/clix/

Hmm, an interesting tool (for anyone who doesn’t want to follow the link, it looks to me like a Terminal for beginners that tries to give suggestions and some GUI to terminal commands).

My method, though, is to use “man commandname” for any new command that I don’t know.  I can find commands to do just about anything via Google, then I read up on what the parts are to increase my vocab and make sure I’m not doing anything that actually COULD break the system.  Most commands won’t break the system with a simple typo but rather will give an error message.

Interesting article.  I knew about most of these, except the “Paste Escaped Text”. 

It’s too bad though.  Your use of the double underlined add linking (vibrant) has forced me to unsubscribe from your rss feed.  I’ll miss you guys.

Interesting article.  I knew about most of these, except the “Paste Escaped Text”.

I agree. I’ve been a long-time command-line jockey and had never heard of the “Paste Escaped Text” until today. Melissa, you rock. wink

It’s too bad though.  Your use of the double underlined add linking (vibrant) has forced me to unsubscribe from your rss feed.  I’ll miss you guys.

Sorry to hear that, Josh. Our content isn’t free, of course, and viewing our choice of ads are the way you pay for it (so that we can, in part, pay writers like Melissa for producing such excellent content). That said, I do completely understand and respect your need to take a stand where you feel necessary. We’ll miss you, too.

Aw, geez, Dave! Thanks. smile

Cool article; “paste escaped text” is new to me as well.

My favorite time saver not yet mentioned is using the up- and down-arrows to browse command history and repeat recent commands. I also love using

!$ 

in place of retyping the last argument of the last command. For example, you could create a folder and then open it in the Finder by running

mkdir "My Secret Stash"
open !$ 

I also love using

!$ 

in place of retyping the last argument of the last command.

ilikeimac, you taught me something I did not know. I love that!

Post A Comment or Log-in. Need an account? Register here.
 

Recent Headlines - Updated May 27th

Sat, 10:00 AM
MacOS KenDensed - MacOS KenDensed: Apple’s Patent Lawsuit & Antitrust Shuffle
Fri, 5:58 PM
News - Sotheby’s to Auction Steve Jobs Atari Memo (Photo Gallery)
5:42 PM
Free on iTunes - 3 Free iOS Apps for News Hounds
3:00 PM
Rumor - Nest Thermostat Reportedly Coming to Apple Retail Stores
2:40 PM
Particle Debris - The TV Industry’s Dreadful Little Secret
2:33 PM
News - Mobile Devices Account for 20% of Web Traffic in US, Canada
12:49 PM
News - Apple Now Offering “Free App of the Week” for iOS
12:21 PM
News - Tim Cook Declines $75 Million Dividend Payout
11:25 AM
News - Absinthe 2.0 Provides Untethered Jailbreak for iOS 5.1.1
11:09 AM
Quick Look Review - F18 Carrier Landing (iOS) is a Boatload of Fun
10:51 AM
TMO Appearances - Jeff Gamet talks Cool Apps & Accessories on Not Another Mac Podcast
10:12 AM
Hot Forum Topic - Forum Poll: Which is Your Favorite Photo Sharing Service?
 

The Mac Observer Reader Specials

  • Macsales for the Right Mac Memory. Easy to Use Online Guide for no Guesswork! Mac Pro up to 128GB, iMac up to 32GB. MacBook/MB Pro, & Mac mini up to 16GB. - Macsales.com
  • Mac RAM Upgrades: MacBook Pro 16GB kits $475, 8GB Kits for $119.99! iMac 16GB RAM Kits (4x 4GB) for $229.99! Mac Pro Memory 32GB Kit for $399.99, 64GB Kit for $889.99! Mac Hard Drives 2TB Seagate SATA II for $249.99! Click Here!
  • Macpokeronline.com If you're using a Mac, then you've gotta check out PokerOnAMac.com. Online casinos and poker rooms are literally giving away cash and the casino sites at Poker on a Mac do the unthinkable, they actually reward! Join today, the download is free!
  •  Looking to find online casinos for mac? We can help you find the best real money casino sites where you can play your favorite casino games including blackjack and slots.

Apple Stock Quote (AAPL)

Loading...

Hot Topics

TMO Express

Join the TMO Express Daily Newsletter to get the latest Mac headlines in your e-mail every weekday. Find out more!

Top Deals From DealBrothers.com

Recent Features

Support The Mac Observer

We noticed you may be running AdBlock on your computer. It takes real money to run this site and to deliver the news, tips, and opinions you love to read.

If you wish to block the ads that pay for the creation of our content, we ask that you instead support TMO Directly, either with a $5 monthly recurring contribution, or a one-time donation of any amount of your choice. Thanks!

Subscribe with Paypal Donate with Paypal