The Mac Terminal: An Introduction
This article is a piece in a series of upcoming articles.

Mac OS X isn’t just known for it’s fancy GUI. It’s known for it’s powerful underlying core OS, UNIX, and the Terminal is the way that you can access the UNIX base. For you new switchers, the Terminal is equivalent to the Command Prompt in Windows, or the Command Line/Shell/Terminal in Linux. Many Mac users never even open Terminal, however these users are missing out on some of the most powerful features.
To open Terminal, navigate to your Applications folder, open Utilities, and double click on Terminal. You will be greeted with a message similar to this:
Last login: Tue Mar 6 17:21:36 on console
Welcome to Darwin!
ibook:~ Alex$
The last line you see is called the prompt. This will appear after every command you enter and this is where you type your commands. It consists of your computer name, your current directory, and your short username. When you first start Terminal, your current directory will be “~”, which is short for your home directory (/Users/Your username).
One of commands you will use most is ls. The ls command will show you the files and directories that are contained in your current directory. Here’s an example:
ibook:~/Desktop/mammoth Alex$ ls
final1.jpg final3.jpg final5.jpg final6.jpg final7.jpg
By typing ls and hitting enter, the terminal shows me all the files that are in my “mammoth” directory. If you want to see the contents of a directory besides the one you are in, just type ls followed by the directory.
You are probably wondering how to change your current directory. This is done with the cd (change directory) command. Just type cd followed by the directory you want to change to. Example:
ibook:~/Desktop/mammoth Alex$ cd /Users/Alex/Desktop
ibook:~/Desktop Alex$
If you want to get to a directory that is inside of your current directory, just type cd followed by the directory name, as there is no need for a full path. To save time, the terminal has an autocomplete feature (most command lines have this). To use it, press tab when typing a file or directory and Terminal will guess what you are trying to type. Don’t forget about ~. Entering cd ~ will get you back to your home directory. A final, and very useful cd tip is that cd .., will navigate you to the directory above the one that you were in.
If you are experimenting with UNIX commands and need help with a certain command, it is always available. Either type:
command --help (quick help) or man command (full manual) Typing q will get you out of a command’s man page.
Although cd and ls don’t do much, they are a good foundation for further command line adventures.

Best thing to use terminal for if you’re not at home and you need to send an email.
For those who don’t know:
mail somone@someone.com
Subject: Something
Your message
.
And you have sent an email
# command –help
will only work on the GNU tools, thus, using the man pages is much more ideal, that said, mistyping the flags of a command will tell you the usage, as long as you understand it, then its ok.
this made front page at digg.com!
For you new guys out there, don’t do what Gary said, he’s being an *sshole.
That would delete your entire harddrive. So, yeah, don’t do it.
Unsafe comments deleted. What a lame thing to do :/
Gary….way to be a dickhead.
Please ignore comment no 5 – if you are a newbie and you type that command you will basically delete everything on your hard disk.
Not bad. Make some references to other *nix articles on the net.
Other than that, tis great.
–Dalton
[...] read more | digg story [...]
[...] you’re interested in learning about the Terminal, but don’t know where to start, this article from MacApper is a great place to get your feet [...]
Just like linux … mac sucks, linux rulez
Linux Guy, grow up. Just let people use the OS that they want to use for whatever reason they want.
i think the macs are nice… i would get one if they had linux drivers/certification and nividia cards would be nice ati is bad for linux
What exactly is the point of terminal though? I mean, who would want to know what’s in your current mammoth directory?
[...] MacApper » Blog Archive » The Terminal: An Introduction Kanske om jag ska göra nåt nån gång i terminalen, läs då här då (tags: mac osx terminalen) [...]
Knight — there’s a lot more to it than that. Terminal is just as much an interface to Mac OS X as the Finder is; more so, in some ways. Almost anything you want to do on your computer can be done from Terminal
[...] the last Terminal Tutorial, I went over the two commands cd and ls, which just allow you to view your files. In this segment [...]
[...] covers the basics of the Terminal, and two basic commands to get new Terminal users on their feet.read more | digg [...]
[...] The Mac Terminal: An Introduction An introduction to the powerful Terminal in OSX [...]
********* Edited for the terminal code could seriously b0rk your HD if you didn’t know what it was you were doing.
gary roberts is a pirate in the off=season and sails the seven seas pillaging villages!
man, that guy, gary roberts, he’s so awesome!
macs are not as good as gary roberts. Gary Roberts can do more floating-point operations in a second than any macintosh.
gary roberts has better ratings than you
Gary Roberts: a sitcom, a truck….. a legend.
[...] I don’t know the Mac and of course if a Mac user read this thread he can help you much more than me. Anyway, the Mac can use command line commands (Unix style) using the terminal. [...]
[...] read more | digg story [...]
[...] read more | digg story [...]
[...] also serves, simply, as an extra PC around the house. True, I can also learn Unix commands via the Terminal on my mac (on Mac OSX or using a virtual machine to run Linux), but it gives me greater peace of [...]
[...] read the Mac Terminal Introduction by Alex and learn [...]
Welcome to Darwin
sudo rm gary roberts
$
To Knight – The point of using Terminal is basically threefold. First, it’s often faster to use. Second, it can be used to carry out commands with a lot more force, especially the “sudo” command. Third, it allows you to modify preference files that can’t be altered from a “Preferences” menu, and it does it in a way much easier than opening it as a text file.
i almost deleted my entire hard drive because of you a**hole!!
[...] just in case, you do not see your drive there, close the Time Machine settings window, launch Terminal and run the following [...]
You call this in introduction? cd and ls? what do you call advanced?
[...] a free download text editor. The Mac Terminal: An Introduction Top 50 Terminal Commands Common Terminal [...]
If I have several terminal windows open, I can go to the first by typing command 1, the second by typing command 2, etc. I think this is referred to as “making the first window active,” “making the second window active,” etc.
Is it possible to write a unix alias that can be typed in *any* of the Terminal windows and will make, say, the third window active?
Alternatively, is it possible to create a keystroke (say, using Quicken or Applescript) that I can perform no matter which application is currently active, that will make, say, the third window active?
Thanks for any insight
Jake
Hola yo utilizo muxo la terminal en linux me comprado un mabook y mi ermana lo ha borrado de la carpeta aplcaciones, como puedo volver a instalarlo e metido el cd de instlacion y con el pacfist e explorado y mirado todos los paketes, q mas ago?
ughh i need help. please! i have a G4 emac. i recently updated to leopard 10.5. I have everything on here EXCEPT “Terminal” ; i go into “Utilities” and its not there. Is there any way i can download it? Or am i *ssed out? =/
PLEASE HELP
[...] The Mac Terminal: An Introduction [...]
[...] Terminal. If you don’t know how, the learning starts here. You can do it, Happy [...]
I am so freaking happy that I finally figured out how to navigate my way through terminal. Thanks alot for this.
How do I restart from terminal? Lately, if I use applejack on my iMac, OS 10.5.7 it leaves me after saying restarting, which doesn’t happen, then a line saying killing all processes
[...] The Mac Terminal: An Introduction | MacApper Great post introducing people to Mac Terminal (tags: mac osx apple reference tutorial shell programming) [...]
[...] The Mac Terminal: An Introduction | MacApper Great post introducing people to Mac Terminal (tags: mac osx apple reference tutorial shell programming) [...]
Great topic, though it’s not an advance introduction it’s good enough to know there is a terminal. I’ve been working with linux most of my short life and when I actualy find out my new macbook also had a terminal I really was so happy (:
Question about autocomplete in the mac terminal,
In linux when you press the tab key completes the word if possible and if not show the possible options is this also possible in the mac terminal?
I didn’t even think about terminal usage on Mac. I love it on my linux box but Mac hmmmm. Maybe I should get a mac.
[...] Terminal – Too geeky to get into… [...]
[...] extracting the archive open the Terminal, which can be found in /Applications/Utilities/Terminal.app, and navigate to the directory in [...]
[...] to the Mac Terminal on Macapper.com. The link to the article is here if anyone else needs help- The Mac Terminal: An Introduction | MacApper. I will try this approach as well. [...]
I was terrified of Terminal until I read this series.
Figured if I typed something wrong my Keyboard would jump off the desk and bat me around the head or something of the sort.