You might not know this, but macOS and Linux have a lot in common. Sounds crazy, I know, but it’s true.
It all starts at the terminal window. The macOS and Linux terminals share quite a bit. And although macOS defaults to the zsh shell, you can even switch it to use the tried-and-true, Linux favorite, bash shell. But let’s not get ahead of ourselves.
SEE: The best programming languages to learn–and the worst (TechRepublic Premium)
First, you might want to know why you’d want to use this and how to take your first steps with the macOS terminal. Before doing that, understand that the terminal window is where you run commands, so the only GUI involved is the window that allows you to run those commands.
Why would you want to use the terminal window? Because it’s a very fast way to take care of certain things. The terminal also gives you much more power for certain tasks (such as file and directory permissions).
With that said, let’s get to work.
To open the terminal window, click on the Launchpad, type terminal, and hit Enter on your keyboard. When the terminal window opens, you’re ready to run your first command.
Let’s find out which directory we’re in. To do that, type pwd and hit Enter on your keyboard. What you should then see is the current working directory, which will probably be /Users/USERNAME (where USERNAME is your macOS username).
SEE: Apple’s October 18 event: What to expect and how to watch (TechRepublic)
But what’s to be found in that directory? Type ls and hit Enter on your keyboard and you’ll see a listing of all of the files and sub-directories.
Let’s say you want to change into the Documents directory. For that, type cd Documents and hit Enter on your keyboard. Now type pwd and hit Enter on your keyboard, and you should see that you’re now in the Documents directory. If you look closely at the terminal prompt, you’ll see that it lists the current directory after USERNAME@HOSTNAME (Where USERNAME is your macOS username and HOSTNAME is the name of your computer).
Finally, let’s create a file, named TechRepublic.txt, in the Documents directory. This is done with the command touch TechRepublic.txt.
And there you go, you’ve taken your first steps with the macOS terminal. We’ll revisit this topic soon, so you can keep learning how to get the most out of this powerful tool.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.