If you’ve been using a Mac for a long time, you know it’s more than just a fancy point-and-click, window-and-icon interface. Beneath the surface of the operating system is a whole world that you can only access from the command line. Terminal (located in the /Applications/Utilities folder) is the default gateway to that command line on a Mac. With this, instead of pointing and clicking, you type your commands and your Mac makes your bids.
Why would you want to do that? For almost all your computing needs, the normal graphical user interface will suffice. But the command line can come in handy when it comes to troubleshooting your Mac, enabling “hidden” settings, and other advanced tasks. It is a good idea for anyone who is not an absolute beginner to be familiar with it.
If you are new to your Mac’s command line interface. First, how to navigate the file system from the command line prompt.
By default, when you open Terminal, you’ll see something like this:
Last login: Fri Jun 25 10:37:06 on ttys000 romansempire@Mac-Pro-8 ~ %
This is what you see:
The first line shows the last time you logged into your Mac from the command line; that’s the current time, when you’re using Terminal.
The second line is the prompt, and while it can change from system to system depending on configuration, it contains several bits of information by default:
In the prompt above novel essay is the username.
Mac-Pro-8 is the name of the Mac (same as the computer name in the Sharing pane of System Preferences).
The † indicates where you are in the Mac’s file system. † is a shortcut that means the current user’s home folder. (In the Finder, that’s the folder with your username and the house icon.)
The † is a sign that the shell (the default interface Terminal uses) displays to indicate that it is ready to accept a command.
How to see what’s in a folder
When you first get to the command line, you’ll be in your home folder. While you are there, or when you are in a folder (folder in Unix speaking) – you may want to know what’s in it. To do that, use the ls (or list) order. Type ls and press the Return key, and you will see the folders (and/or files) in the current folder.
Plain output ls command is quite scarce; it will show you the names of files and folders in the current folder (including some familiar ones like movies, music, pictures, and so on). Fortunately, you can use some optional switches to the ls command that allows you to see more information. For example, type ls -l (that’s a small L) and then press Return. You see something like this:
Don’t worry too much about what all that means right now – we’re just getting wet feet. The point is that ls may provide additional information about files and folders, depending on the options you specify. In this case, that additional information includes the name of the user who: possess each item in the directory. (That property is part of the file permissions system of the Unix system.) romansempire staff in addition to most of the above items means each is owned by the user novel essaywho is in the group? staff† The other understandable piece of information next to each file and folder is the date and time each file was last modified.
Another useful option: You can view invisible files – files the Finder doesn’t normally show you – by typing ls -a† (These hidden files all have periods (.) before their names.)
Access other folders/folders
If you’re in the Finder and want to go to another folder, find that folder and double-click it. From the command line, use the cd (or change directory) command instead. Let’s say you are in your home folder and want to look in the Downloads folder. To do that, type cd Downloads† (Remember to always type a space after any command that has an extra argument, such as the name of a folder in the previous example.) Once you’ve done that, ls shows you the contents of your Downloads folder.
Here are a few quick tricks for moving around your Mac’s file system.
when you type cd and press the return key – with no folder specified – you will go back to your home folder. (You can also type cd ~ to go there.)
when you type cd /go to the root level of your startup disk.
when you type cd .. (that’s two dots), go to the folder above the one you’re currently in. So when you’re in your home folder, and type cd ..go to your Mac’s /Users folder.
And when you type cd - (hyphen) returns you to the directory you were in the last time you opened the . spent cd order.
To learn more Terminal commands, see our articles on how to copy and move folders and delete files and folders using the command line and get help when you need it from man pages.