25 Terminal Tips Every Mac User Should Know

31

Comments

+ Add a Comment
avatar

vampyr

I'm trying to connect to a remote computer (tip #13) and so far, typing in the password has been an issue. Firstly, each time I type in the password, nothing comes up. It's as if my keyboard died. And secondly, I may have been following the instructions wrong since I'm still new to Terminal and haven't gotten used to all the terminology and commands e.g. what's the difference between remote and local? Anyways, I seem to have done them all right since I got through every step but the password bit. Please help!

P.S. I read somewhere that the password is a 'ghost' and that I have to type it blindingly. I know the password, tried typing it, failed.

avatar

Hyperscripter

I used the script "rsync -auE --progress ~ /Volumes/name-of-drive/name-of-backup-folder" to back up my home folder and named it "MyHome Backup". It apparently worked just fine, but I was just wondering where it put it ?

Also, I was wondering how I could send this from an AppleScript ?

avatar

lencybrostan

Mulberry Replicas

avatar

lencybrostan

Apple is been always known for the security and the Application.By default,the Terminal targets your Home directory folders are called directories in Terminal-speak. You can move to different directories by executing the command cd path-to-directory.

Mulberry Replicas

avatar

lencybrostan

Apple has the tremendous impact for the application and the security.The Terminal application is Apple’s implementation of a traditional Unix command-line environment, also called a shell. Keep in mind, though, that Unix shells come in many different flavors.

avatar

triathlon

A triathlon is divided into three components: swimming, cycling and running. This can be daunting for novices and those trying a triathlon for the first time. Novice triathlon training should focus on learning how mixing these three separate sports have an effect on your body.
triathlon training programs

avatar

triathlon

I'm ready to ssh into another Mac (or pc) on my home network, how do I discover their IP addresses without getting up out of my chair? I know that I can walk around the house and look in the Network Prefs to learn the IP address but I want to do it remotely. In my old Linksys router there was a panel in the web admin control screen showing the IP addresses of all the clients on my network. I don't see this in the Airport Utility for my new Time Capsule.

my first triathlon

avatar

lora.a

I am sure that a lot of people didn't know about these things when it comes to using Mac. I am grateful that you thought about us and put this information in this post for us.knee pain | pain relief

avatar

DSilda

I am the only one using my MacBook Pro. I would like to know where Permission errors come from.

avatar

brawns214

This list is great, and it goes from beginning to much more advanced.

Try

sudo !!
This reexecutes the last command entered as root. Great for when you get pesky 'Permission Denied' errors

A mac exclusive! When you have a file in the finder that you want to do something with, you can just drag it into terminal and it will put the path (the file's location) to that file where your cursor is.

Having trouble deleting a large amount of stuff from trash or taking too long to do the 'preparing to delete' thing? Try:

sudo rm -rf /.Trashes/*
or
sudo rm -rf /Volumes/Secondary-hard-drive/.Trashes/*

If you forget to put the .Trashes in the command, you could end up deleting a significant amount of important stuff.

avatar

The Disciple

I executed this command "diskutil secureErase freespace 3 /Volumes/Macintosh\ HD" and it's running the erase but it seems to have doubled the contents of the HD, if only temporarily. Is this normal cause there's like Zero room left on my HD? Will it go away after the erase is complete? I just backed up w/ time machine on an external so I'm not super worried, but I'd just like to know what's going on.

Thanks
Nick

avatar

random99access

How did this work out for you?  Space back to normal?

avatar

mattone

I enjoy these types of articles. Keep them coming.

Re: SSH
So now that I'm ready to ssh into another Mac (or pc) on my home network, how do I discover their IP addresses without getting up out of my chair? I know that I can walk around the house and look in the Network Prefs to learn the IP address but I want to do it remotely. In my old Linksys router there was a panel in the web admin control screen showing the IP addresses of all the clients on my network. I don't see this in the Airport Utility for my new Time Capsule.

Is there a way to use the terminal to do this?

Matt

avatar

Grimshaw

You can use a little app called Flame that will list all the IP addresses in your network.

avatar

Bownse

Or simply log into your NAT router and look at the DHCP assignments.

avatar

ndrw

Hi,Just a quick note about Ctrl-Z. When you use Ctrl-Z to stop a job or process that is running, it doesn't "kill" that process, just interrupts it and makes it wait. This is actually quite handy at times, because you have some job control you can do afterward:1) run the "jobs" command to see a list of jobs you've got waiting.2) run the "fg %#" command to bring a command back to active from the jobs list (use the number instead of the pound symbol).3) run the "bg %#" command to let a job run in the background (great for calculations and tasks that don't have much output!).4) run the "kill %#" command to kill the job.Be sure to put the percent symbol before the jobs list number, especially with the kill command, otherwise, it will use the process id (run "ps auxw" to see a list of all processes).Cheers,Andrew

avatar

freyutss

Very good tips to follow. I am sure that a lot of people didn't know about these things when it comes to using Mac. I am grateful that you thought about us and put this information in this post for us.

______

Royal Caribbean Cruises

avatar

apstewart

I'm relieved to see you corrected the "key" on the image in tip #3 as printed in this issue of the magazine, which was grossly incorrect. Now just change #15 to use Ctrl-C to stop ping, instead of Ctrl-Z (not Command-Z) which just suspends a command instead of stopping it. Yes, the picture says "Stopped", but it's still running. Type "fg" after hitting Ctrl-Z and you'll be taken right back to the ping. Same Ctrl-Z foolishness on #17.

avatar

b_dubb

i'd love to see some 411 on customizing Vi(m) on the mac. for when i want to edit a file without opening a bloated text editor (dreamweaver).

b

avatar

cyberdog

How do you turn off the reformatting?

avatar

LeftClicker

then click Format > Make Plain Text or press Shift-Command-T.  This will strip the document of all formatting (e.g. font, color, italicize, etc.).

avatar

cyberdog

What a very timely article (for me at least!). I was just looking into this... It is always a hassle setting up a new computer, it would be nice if I could just run a script that would configure some/most of my system for me. I've found some commands that looked promising but ran into a few road blocks... I went to my local Apple Store and there the Genius told me that they didn't do Unix! That sucks. Here what I have so far:I randefaults read com.apple.finder DesktopViewOptions{ IconViewOptions = { ArrangeBy = none; BackgroundFlags = 0; BackgroundType = DefB; FontSize = 12; GridSpacing = 73; IconSize = 48; PropertiesLocation = botm; ShowPreviewIcon = 1; ViewMoreInfo = 0; };}I could reset the icon size or the font size or the grid spacing but not all three of them at once by using one of the following:defaults write com.apple.finder DesktopViewOptions -dict IconSize -integer 32;defaults write com.apple.finder DesktopViewOptions -dict FontSize -integer 11;defaults write com.apple.finder DesktopViewOptions -dict GridSpacing -integer 40;killall FinderI'd like to do something along the lines of:defaults write com.apple.finder DesktopViewOptions { IconViewOptions = { FontSize = 11; GridSpacing = 40; IconSize = 32; };}But this does not work. Any ideas?

avatar

cyberdog

What a very timely article (for me at least!). I was just looking into this... It is always a hassle setting up a new computer, it would be nice if I could just run a script that would configure some/most of my system for me. I've found some commands that looked promising but ran into a few road blocks... I went to my local Apple Store and there the Genius told me that they didn't do Unix! That sucks. Here what I have so far:I randefaults read com.apple.finder DesktopViewOptions{ IconViewOptions = { ArrangeBy = none; BackgroundFlags = 0; BackgroundType = DefB; FontSize = 12; GridSpacing = 73; IconSize = 48; PropertiesLocation = botm; ShowPreviewIcon = 1; ViewMoreInfo = 0; };}I could reset the icon size or the font size or the grid spacing but not all three of them at once by using one of the following:defaults write com.apple.finder DesktopViewOptions -dict IconSize -integer 32;defaults write com.apple.finder DesktopViewOptions -dict FontSize -integer 11;defaults write com.apple.finder DesktopViewOptions -dict GridSpacing -integer 40;killall FinderI'd like to do something along the lines of:defaults write com.apple.finder DesktopViewOptions { IconViewOptions = { FontSize = 11; GridSpacing = 40; IconSize = 32; };}But this does not work. Any ideas?

avatar

Jamie

And lest some users are thinking this is too uber-geeky for mere mortals such as themselves, it's worth mentioning that highlighted text from any text document can be dragged right into an open terminal window. If anyone were uncomfortable typing directly in Terminal, they could save a document of their favorite commands and just drag 'em over. Easy.

Log in to Mac|Life directly or log in using Facebook

Forgot your username or password?
Click here for help.

Login with Facebook
Log in using Facebook to share comments and articles easily with your Facebook feed.