In this series we introduce you to commands for the command line of macOS which make life easier and faster.
The command line or the terminal can be found on macOS in the menu bar of your Mac under Go to > Utilities > Terminal. We know many people have never used this type of command prompt before. This is often because a command line, unlike a graphical user interface, does not display the options you can use – you need to know them.
And this is exactly where we want to start: from now on we will show you a command from time to time, so that you at least can act a little on the command line and lose your fear of it.
Today’s command: Change into another directory.
Change directory.
cd : command directory
After we have already shown you how to find out in which directory you are, you may be in risk mood after two coffees and would like to change the directory. Simply enter cd and the name of the desired directory.
If, for example, you are in your home directory (this is automatically set when you open the terminal) and would like to change to your “Documents” directory, enter the following:
cd documents
There are three things to note: the English names for the folders are valid, upper and lower case is irrelevant in this case and if you want to call a folder name with spaces, you have to put it in quotation marks:
cd "macintosh hd"
If you are now a completely different directory and the above directory is not the one you want to call, you will have to enter the complete path to that directory. So if you are somewhere in the directory tree and want to jump directly to your document directory, you have to enter this (now with “/”):
cd /users/yourname/documents
If you have your home directory on a different drive, for example an SSD/HDD combination, the path might look like this:
cd /volumes/hdd/yourname/documents
Now a super trick: to get to know the paths at the beginning or to save a bit of typing when copying back and forth, you can simply drag a folder into an open terminal window. So just drag your document folder into the terminal: as a result the path to it will be inserted. Very practical.
If you want to jump back a directory, it is the command
cd ..
That’s a space and two dots. So it goes backwards, so to speak.
Jump around a bit in your directory tree and get to know the structure. So you’ll soon know your way around the system and where what is located.