Just imagine, a little over 20 years ago we were barely able to drag a mouse across the screen, let alone get around a desktop interface without typing in a few command lines. Forunately, things have drastically changed, but the command line still provides a powerful way of interacting with your Mac.
Unfortunately, most Mac users never dive into Unix because of how intimidating it can seem at first. But familiarizing yourself with it -- even a little bit -- is a good idea for your coding arsenal. We rounded up some of the most utilized Unix commands you should know so you can get started tinkering with Terminal.
Uploading and downloading files through a server over FTP is easy these days with modern FTP clients like Transmit, CyberDuck, or Flow. But if you happen to be in a situation where you're away from home and the Mac you're using is unequipped with a handy FTP client, you can easily retrieve and upload files using the command line. In this how-to, we’ll show you how to put the command line to good use by connecting to an FTP server.
We saved the best and easiest for last. By now, you’ve no doubt tried many of the commands, but this can leave your Terminal command rather busy with text flowing here and there. If you want to get rid of all the previous commands and outputs being displayed on the screen, simply enter clear followed by the enter key. This will wipe your Terminal screen clean, ready for you to type more commands.
Control + C is a way to tell a running command line-based program to quit and return you back to the command line prompt. So, if you were running a ping or other command line tool, just press Control + C to get back control.
Sometimes it may be necessary for you to run a command as an administrator. If you were to get an error like “Error: Insufficient privileges,” just type the sudo command before the command you were actually trying to type. This will in turn cause Terminal to ask you for your password to authenticate you as an administrator.
The sudo command is needed for things like chmod, MacPorts, and other administrative tasks.
Cat is a simple way to view the contents of a file. The name is short for “concatenate and display files.” Let’s say you have a file called “test.txt” in your working directory. You think you can delete it, but you’re not sure what the contents of the file are.
No, we’re not talking about those old compact discs that people used to listen to, we’re talking about “change directory.” This command does just that. Type this command followed by the name of a directory that you wish to change to, and it’ll change to that directory.
Pwd stands for “print working directory.” The working directory is whatever folder you’re currently in, which typically is the receiver of an action (such as directory creation or deleting files inside of a certain directory). So, if you’re ever uncertain about which directory you’re in, just typed pwd and Terminal will spit back to you the directory location.
This command creates a new folder in the current working directory. So, if you’re in a folder called Documents and you wanted to create a subfolder called “Test”, you could type the following command to create that folder: