50 Mac Terminal Commands you NEED to know (in 10 minutes)

Watch the Video

Thanks to our sponsor
Video Sponsor

CLICK HERE
to learn more

Video Notes:

I know your password. Change it with Dashlane: https://www.dashlane.com/networkchuck50 (Use code networkchuck50 to get 50% off) 

In this video, NetworkChuck shows you the top 50 MacOS terminal commands you NEED to know. Now, while Mac OS is unix-based and very similar to Linux, it has its nuances and things worth paying attention to. Things like, making your Macbook talk, finding wifi passwords, diving into the matrix and taking a trip to the aquarium, all from your terminal. 

0:00   ⏩  Intro

0:12   ⏩  say

0:23   ⏩  security find-generic-password -wa Wifi

0:40   ⏩  pbcopy

0:54   ⏩  command + option + shift + v

1:08   ⏩  caffeinate

1:20   ⏩  command + shift + 3

1:53   ⏩  defaults write com.apple.screencapture name

2:10  ⏩  defaults write com.apple.screencapture type

2:19  ⏩  default write com.apple.screencapture location ~/Desktop/screenshots

2:40   ⏩  passwd

4:11   ⏩  cd

4:17   ⏩  ls

4:20   ⏩  pwd

4:26   ⏩  whoami

4:32   ⏩  mv

4:36   ⏩  cp

4:41   ⏩  ditto

4:48   ⏩  df -h

4:51   ⏩  nano

5:00   ⏩  man

5:09   ⏩  open

5:18   ⏩  ping

5:25   ⏩  ifconfig

5:36   ⏩  grep

5:43   ⏩  awk

5:53   ⏩  traceroute

6:04   ⏩  dig

6:12   ⏩  ps

6:21   ⏩  top

6:31   ⏩  kill

6:47   ⏩  which $SHELL

6:56   ⏩  bash

7:00   ⏩  zsh

7:05   ⏩  uptime

7:10   ⏩  killall mDNSResponder….and more

7:15   ⏩  qlmanage

7:22   ⏩  diff

7:27   ⏩  curl

7:42   ⏩  leave

7:54   ⏩  history

7:59   ⏩  disable gatekeeper

8:20   ⏩  brew

8:46   ⏩  cmatrix

9:02   ⏩  asciiquarium

9:13   ⏩  toilet

9:31   ⏩  tetris

9:48   ⏩  python3

10:18 ⏩  shutdown

10:33 ⏩  sudo touch id

Here are the top 50 Mac OS terminal commands you need to know. So get your coffee ready. This will take about 10 minutes. First, how do you launch a terminal? Hit the command key and space bar. Search for a terminal. There it is to enter and you’re there. Let’s do something fun first. We can actually make our Mac talk right from the terminal. Just type in say and whatever you want to say and 

Whatever you want to say. Isn’t that 

Awesome? I mess with my kids a lot with this one. Did you know your Matt keeps a record of all the wifi passwords you’ve ever used and we can find those passwords right from the terminal. Check this out. The command is security find dash generic dash password, do a dash w and then the name of that wifi network. I haven’t been here in ages, but there’s the password right there. If I wanna quickly copy that and share it with a friend, run that command once more but do a pipe and type in PB copy and this will copy the output of any command to your clipboard allowing me to send Nick that password. And you can use PB copy with any command. Now I’m sure you know how to copy and paste on your Mac, highlight some texts. Command C and command V to paste. 

But often you don’t want that format, you just want the plain text, the pace without formatting, command options shift and V plain text. And I know that wasn’t the terminal but it’s still pretty cool. How do you stay awake? Caffeine your Mac the same way and the terminal type in caffeinate and enter and as long as your terminal is up, your Mac will stay awake and then hit control C to stop coffee break for that. Taking screenshots on a mac is pretty easy. Command shift three, your whole screen and by default saves to your desktop. There it is. That’s cool, but I kind of hate that. What I always do is command shift four, which allows me to select just part of what I wanna copy and saves it to the desktop. But even better, it’s command control shift four. It’s getting crazy and when you capture it, it goes to your clipboard. 

So I can tell Nick how awesome Dashlane is. There you go, Nick. And Nick does love using Dashlane. Don’t you better say yes Nick, I’m gonna lock you in a liminal space. Now I know that wasn’t a terminal command, but with the terminal you can change the default name of your screenshots cuz right now they’re named random as you can see down here with this command. And this is kind of wordy, so I’ll have all these commands below, but defaults right com, dot apple, dot screen, capture name, and then whatever you wanna name it. So now when I capture my screen, it’ll name it exactly what we want. We can also change the default file type with the type option. Let’s say we want JPEGs instead done. Or we can also change the location with the location option on where our screenshots are saved. Now don’t get scared but your Mac does keep a history of everything you download. 

Like seriously, it’s in a database. Use this command to see what you’ve downloaded and it’s actually in a sequel light three database, kind of interesting. And right there it’ll show you a lot of empty space, all the things you’ve downloaded, even if you clear your browsing history. So if you don’t want Tim Cook or anyone else to know what you’ve been downloading, use this command to clear that stuff. Nothing there to change your password, you don’t have to leave the terminal. Just type in P A S S WD or password and you can change your password. And then I’ll go ahead and update my key chain user with that command they provide. And by the way, I have a different password for everything. You should too. And I know it seems impossible to manage but not with Dashlane sponsor of this video. Dashlane is the password manager I use for personal stuff and for my work stuff. 

In fact, I just shared a password with one of my new employees in the other room, which by the way, I don’t know how I would’ve onboarded this new employee without dash lane. They make it so easy sharing passwords and logins and all kinds of stuff. Now personally it tells me my password health, I have some work to do. 29 compromise passwords. Are your passwords compromised? You may not know, but thankfully Dashlane does do some dark web monitoring. They watch for you and I also have some work to do here, <laugh> goodness. Now for my company I use Dashlane to manage all my employees passwords, making sure their passwords are healthy, that they’re changing them, especially my new employees. I’m watching you Michael. Change your passwords. I’ll show you too Nick. I can also see you what all my employees are doing as far as their password health. 

And then this by far is my favorite feature of Dashlane. Not only will they fill in your passwords right here in the browser, wherever you are, but they got two factor built in. All you gotta do is click it and then put it in done. So make sure you got a different password for every service and do it well with Dashlane. Check it out, link below and use my code network. Check 50, you’ll get 50% off at checkout. Don’t get hacked, do this. Now you may have known that Mac is very similar to Linux. They’re both Unix based, which means a lot of the commands on Linux work on Mac. So let’s take a quick coffee break and then I’ll speed around. My favorite linnux commands I think you need to know for your Mac CD will change your current working directory. Type in CD where you want to go and you’re there. 

Type in CD space to get back home. The LS command will list all the files of folders in your directory wherever you are. But where are you? Let’s find out with the PWD command. We’ll print your working directory. There I am. But who am I? <laugh>. You can find out with the who am I command telling you exactly who you are. In case you forget, we can move files with the MV command specifying our file and where we wanna move it to. We can use the CP command to copy files specifying our file and where we want to copy it too. Mac OS actually has a better version of that called Ditto, which I love cuz well it’s called Ditto and it works in a very similar way to the CP command. Use the DF dash H command to see how much space you have on your hard drive. 

Use the nano command to start editing a file right here in your terminal. No need to go anywhere and in control X, Y and enter to save and get out of there. Use the man command to learn about your commands, man. Sorry for that. I can man nano to find out what it is hitting Q to quit that I can, man. Man, I can use the open command too. Well uh, open things like the screenshot. Bam. Yes, I know you can click on it but it feels so much better opening it from a terminal, doesn’t it? It does. If you wanna see if your favorite website is up and running, type in the ping command and then the name of the website. If you get responses then it’s up it control C to stop that. What’s your IP address? Type in if config, but maybe you can’t find it like me. 

Try doing. If config and specifying the e N zero interface, this will work for most people. Now that’s kind of messy. We’ll do that same command but we’ll do a pipe and use the grip command, which allows us to filter all what we wanna see. So I’ll dore inet better, even better is the A command, another pipe type ink. And with some crazy regular expression stuff I get just the IP addresses, both IPV four and IPV V six to see the path through the internet that you’re taking to get to a certain website, type in trace route. This one’s really cool trace route the website you wanna see and we’ll show you every router you hit, including the latency. Great for troubleshooting. If you want to dig into the DNS of a website, you can use the tool called dig. Dig the website name and you all the DNS goodness. 

If you wanna see all the processes on your computer, type in the PS command, which won’t tell you a lot so you have to tell. You wanna see more, type in PS dash ax and you do get a lot more with the top command. You can see which processes are using the most CPU real time. You can also filter by memory by doing top dash o are size, seeing what’s using the most memory on your computer. One of my favorite commands, the kill command will kill a running process. So I’ll find my running process. I wanna kill with the PS command. I’ll regret for the name, find my process id. There it is. And then I’ll do kill dash nine and the process ID and I killed it. Speed round done. Now with the Mac o s terminal, you can use different types of shells. 

That’s our next command. Find out what you’re using with the which shell dollar sign. Shell command. Hey, we’re using Zsh but you may not want to. We can switch to good old Bash by typing in Bash and suddenly we’re in Bash world. Or we can switch back to Zsh with the eSSH command. And we’re using Zsh again. How long has your Mac been up? We can find out with the uptime command. Seven days. Woo. It’s a good boy to flush your DNS cash. You’ll use these series of commands to make it happen. Put in your pseudo password and you’re good to get a quick preview with the file. We can do that from the terminal. The QL managed command with the dash P and the file name little preview, just like that. If we want compare two files, we can use the diff command diff and the file names. 

We can also download files through our terminal with the curl command. Curl the URL you wanna download from. And then just use a right atic point to where you wanna store done entire BI downloaded. We can also curl the weather curl wtt, r i n slash and where you wanna be. If you’re spending too much time in the terminal, you can set an alarm in your terminal. Type in leave and what time you want the alarm for. We’ll say 1245 alarm set. And it tells you to leave because you have to be told to leave the terminal. It’s too fun to see it history, all your commands because you’ve been typing a lot of commands type in history and there they are. This one’s pretty handy cuz you can disable your gatekeeper. The thing on your Mac that keeps you from installing apps you want to install that might be insecure, but whatever. 

I know what I’m doing to do that. One simple command, pseudo SP CTL space dash master dash disabled. Put in your pseudo password, take that gatekeeper. Now. I would not do that for anyone that doesn’t need it. Like your parents don’t. Don’t let them do that. Now here are where the commands get kind of crazy and fun and amazing, but we gotta do something first. We have to install brew because everything good starts with a good brew there. Check Coffee Brew is known as the missing package manager for Mac West. And you probably didn’t know it was missing, but hey, we found it. Install it with one command. I’ll have that below. It’s kind of wordy. And let it do its thing. It might take a moment. So go ahead and take a little coffee break while your brew is brewing. Do your brew brew, brew some br, drink some coffee. 

And now we can have some fun. This first thing I wanna show you is crazy. Type in brew install C matrix. Once installed, simply type in C matrix and take the red pill. Neo <laugh>. How cool is that? Pick control cda, exit the matrix. This next one is pretty cool too. Brew Install Askie Aquarium. And when installed, simply type in Askie Aquarium and go Fish. Dude, I could watch this all day. You ask a little ship going across. All right, control cda, get out. Toilet. Toilet. That’s the name of this next one. That’s kind of weird. Brew installed toilet. Fun fact. I used to sell toilets and once installed, you can turn any name, text, whatever into Askie character art like this Toilet network. Chuck. Ah, beautiful Toilet. Hi Nick. Hi Nick. That’s just fun and I know you were wondering. Chuck, can I play Tetris and Terminal? The answer is yes. Duh. Brew install Sam t Tetris. Install it. And then simply type in Tetris. Choose your level and go to town. 

Yes, the terminal can do everything and more. Hit escape to get out of there. Now your Mac does have Python three installed by default. Python is amazing. Two amazing for me to tell you everything. But one thing you can do is start a little web server right from where you are. Type in Python three dash m htt t, no attp dot server. And suddenly you have a little web server on four 8,000, which means anybody on your network can go to your IP address on port 8,000 and browse your stuff. Which means you can easily share files just like that in case all the other stuff doesn’t work. That’s pretty cool, I think. Hit control seat and that web server. And when you’re ready to shut down your computer, you don’t have to leave the terminal, you can stay right here with the shut down command. 

Shut down dash H now for right now or dash R and now for a restart. And finally I save the best for last. This one’s stinking cool. If you’re like me, you’re tired of typing in your pseudo password. If only we could just use our finger instead of pseudo. And that’s what this is. You can use your touch ID on your MacBook as your pseudo password. Want to ask you for to do that, we’ll type in pseudo first, type in nano, and we’re going to edit the file slash et tc slash pam dotd slash pseudo. Put your pseudo password in for the last time and just below that first comment, add this line off sufficient pam underscore t i d dot. So control X, Y enter to save. Hit. Okay, and let’s see if it works. Let’s try one of our commands from earlier clearing our DNS cash. Here we go. That’s killer. Best command ever. Video over buy.

Check Out Network Chuck's Coffee and MERCH Shop