Mac Terminal tips for beginners

Sam Lesser
3 min readJul 26, 2020

--

yup, I’ve been there…

I feel your pain :(

Pulling out your hair trying to make sense of a confusing file directory? I completely understand, the interface can be confusing at first. It also doesn’t help if you’re a “point & click”, Windows user like I was. It was a huge change for me, jumping into a CLI(Command Line Interface). My experience is that it can be scary or frustrating at times.

Please Don’t be too hard on yourself though, you’ll make this change quicker than you think. You must understand there’s a small learning curve, but it’s totally worth it! This means it’s more about practice, then it is about how well you can memorize shortcuts. Keep with it and you’ll be a Mac Terminal Pro. Until then, please let me share some helpful tips and common short-cuts, that will make your experience a much smoother ride.

File Tree can look like this, but please don’t be scared.
Picture roots of a tree

Understanding a File Tree

First let’s understand the structure of the Mac Terminal. I like to visualize the whole thing in my head, and compare it to something I can relate to. In this particular case, I picture the root system of a tree connected to -little caves or rabbit warrens. Each root passes through a directory or “rabbit warren” where your files and folders live. Through this hierarchical file structure you can access the “rabbit warrens” through different root systems.

You will always start at your home directory or the base of that tree when you open your terminal. From there you dive deeper into the structure. It’s common for it to branch off from other parts, which in turn can have it’s own sub sections. The pattern keeps going until you hit the root tips or in this case the deepest directory/rabbit warren. If you’re ever lost (which can happen a lot), just look left from your cursor. This will tell you what directory you’re currently in.

Make sure you’re in the right place !

It’s a common mistake for most beginner’s, so it’s worth mentioning again here. Try to always be aware of your location in a directory. It’s often the cause of many errors, never hurts to look at your directory before creating a file or cloning off git hub. I’d get in the habit of using the handy “ls” or “pwd” shortcuts, BEFORE you make your move. It keeps you from making silly errors, especially when you’re tired or working late at night .

Short-cuts you should know well

These are great to know and will cut down on a lot of time. Get to know them and Terminal will be a much friendlier spot to work in.

pwd print working directory, I use it, it shows you how you got there.ls shows you all the files in this directory, that’s what’s under ya!cd ~ home sweet home directory!cd .. brings you to your last directory. Think like going up a floor.
mkdir
makes it in your current one, make sure you’re in the right place.
touch makes a new file, same idea here.code . opens your default text editor.clear clears your terminal screen

Additional Cool Stuff

Here some other helpful things you can do with short-cuts.

rm -R<folder> selects all files you want deleted in a folder.rm -iR<folder> confirms what you want deleted.ditto[folder A][folder B] move folder A files to folder B-v shows files being copied to [folder B]

Here’s a link for more shortcuts on the Apple website:

https://support.apple.com/guide/terminal/keyboard-shortcuts-trmlshtcts/mac

--

--

Sam Lesser
Sam Lesser

Written by Sam Lesser

Career Changer, Software Engineer & Web Developer

No responses yet