50 macOS Tips and Tricks Using Terminal (the last one is CRAZY!)

NetworkChuck
21 Nov 202211:11

Summary

TLDRThis video script offers a comprehensive guide to mastering Mac OS terminal commands. It begins with basic instructions on launching the terminal and progresses to fun and practical commands like making the Mac speak, retrieving Wi-Fi passwords, and managing screenshots. The script also covers essential Unix-based commands, file operations, and system information retrieval. It introduces advanced topics like using 'brew' for package management, installing entertaining utilities, and leveraging Python for a web server. The video concludes with a nifty touch, enabling Touch ID as a sudo password, enhancing user convenience and security.

Takeaways

  • ๐Ÿ› ๏ธ Launching a terminal on Mac OS is as simple as pressing the command key and space bar, then searching for 'terminal'.
  • ๐Ÿ—ฃ๏ธ The 'say' command in the terminal can make your Mac vocalize any text you type in.
  • ๐Ÿ”‘ The 'security find-generic-password' command can retrieve Wi-Fi passwords you've used, with 'pbcopy' to copy them to your clipboard.
  • โ˜•๏ธ 'caffeinate' can be used to keep your Mac awake as long as the terminal is open, and 'control C' can stop it.
  • ๐Ÿ“ธ Taking screenshots can be customized with various keyboard shortcuts, including command control shift four to copy the screenshot directly to the clipboard.
  • ๐Ÿ“ The 'defaults write com.apple.screencapture' command allows you to change the default name and file type of your screenshots, as well as the save location.
  • ๐Ÿ•ต๏ธโ€โ™‚๏ธ Your Mac keeps a history of all downloads, which can be viewed and cleared using specific terminal commands.
  • ๐Ÿ”’ You can change your Mac's user password directly from the terminal with 'passwd'.
  • ๐Ÿ”‘ Dashlane, the video's sponsor, is highlighted as a password manager that helps in securely managing and sharing passwords.
  • ๐Ÿ” The 'man' command provides manual pages for understanding how terminal commands work.
  • ๐Ÿ“ˆ The 'top' command shows real-time process information, and 'kill' can be used to terminate processes.

Q & A

  • How do you launch a terminal on a Mac?

    -Press the command key and space bar to open Spotlight Search, then type 'terminal' and hit enter to launch the Terminal application.

  • What is a fun way to make your Mac talk using the terminal?

    -You can make your Mac say something by typing 'say' followed by the text you want it to speak in the terminal.

  • How can you retrieve the WiFi passwords you've used on your Mac from the terminal?

    -Use the command 'security find-generic-password -w [name of the WiFi network]' to find the password for a specific WiFi network.

  • What command can you use to copy the output of any command to your clipboard on Mac?

    -You can pipe the output of any command to 'pbcopy' to copy it to the clipboard.

  • How do you copy and paste plain text without formatting on a Mac?

    -Highlight the text with the Command key, then use Option-Shift-V to paste it as plain text without formatting.

  • What command can be used to keep your Mac awake as long as the terminal is open?

    -Type 'caffeinate' in the terminal to prevent your Mac from going to sleep.

  • How can you change the default name of your screenshots on Mac using the terminal?

    -Use the command 'defaults write com.apple.screencapture name [desired name]' to change the default screenshot name.

  • What is Dashlane and how is it used in the context of the video?

    -Dashlane is a password manager that helps in securely managing and sharing passwords. It was mentioned in the video as a sponsor and used to demonstrate password sharing and health monitoring.

  • How can you see the history of all the downloads on your Mac?

    -There is a command that allows you to view a log of all downloads, but the specific command is not provided in the script.

  • What command can you use to change your Mac's password from the terminal?

    -Type 'passwd' in the terminal to change your Mac's user password.

  • How can you use the terminal to install Homebrew on your Mac?

    -The script mentions that Homebrew can be installed with a single command, but the exact command is not provided in the transcript.

  • What is the purpose of the 'brew install cmatrix' command mentioned in the video?

    -The 'brew install cmatrix' command installs a program that simulates the Matrix screen effect, providing a fun and visual experience when typed in the terminal.

  • How can you use the terminal to set an alarm for a specific time?

    -Type 'date' followed by the desired time in the format 'MMDDHHmm' to set an alarm in the terminal.

  • What command can you use to disable the Mac's Gatekeeper temporarily?

    -Use the command 'sudo spctl --master-disable' to temporarily disable the Gatekeeper feature on Mac.

  • How can you use the terminal to enable Touch ID as your sudo password?

    -Edit the file '/etc/pam.d/sudo' by adding the line 'auth sufficient pam_tid.so' just below the first comment, then save and exit.

Outlines

00:00

๐Ÿ˜€ Fun and Practical Mac Terminal Commands

This paragraph introduces the top 50 Mac OS terminal commands, starting with launching the terminal and demonstrating how to make the Mac 'talk' using the 'say' command. It covers retrieving Wi-Fi passwords with the 'security find-generic-password' command, copying command outputs to the clipboard with 'pbcopy', and various clipboard usage tips. The paragraph also touches on keeping the Mac awake with 'caffeinate', taking screenshots with different shortcuts, and customizing screenshot names and file types. It concludes with a mention of Dashlane, a password manager, and its features for personal and business use, including password sharing and dark web monitoring.

05:00

๐Ÿ›  Essential Unix Commands for Mac Users

The second paragraph delves into Unix-based commands that are applicable to Mac OS, such as 'cd' for changing directories, 'ls' and 'pwd' for listing and printing the current directory, and 'who am i' to identify the user. It explains file manipulation with 'mv' and 'cp', and introduces 'ditto' as an improved version of 'cp'. The paragraph also covers disk space checking with 'df -h', file editing with 'nano', and learning about commands using 'man'. Additional commands for opening files, checking website status with 'ping', finding IP addresses with 'ifconfig', and viewing internet paths with 'traceroute' are highlighted. The paragraph wraps up with commands for DNS lookups, viewing and managing processes, and changing shells between Zsh and Bash.

10:02

๐ŸŽฎ Creative and Entertaining Terminal Activities

The final paragraph showcases creative and entertaining uses of the Mac terminal, starting with installing Homebrew, the package manager for macOS, and using it to install various applications like 'cmatrix' for a Matrix-like display, 'askie aquarium' for a terminal fish tank, and 'toilet' for ASCII art. It also covers playing Tetris in the terminal with 'sam' and setting up a simple web server using Python's built-in http.server module. The paragraph concludes with a guide on using Touch ID as a password for sudo commands by editing the '/etc/pam.d/sudo' file, providing a hands-on, convenient alternative to typing passwords in the terminal.

Mindmap

Keywords

๐Ÿ’กTerminal

The terminal is a command-line interface that allows users to interact with their computer's operating system through text-based commands. In the video, the terminal is the primary tool used for demonstrating various Mac OS commands, such as launching it with 'Command + Space' and using it to make the Mac 'talk' with the 'say' command.

๐Ÿ’กCommand

A command in the context of the video refers to an instruction given to the terminal that the operating system executes. The video provides numerous examples of commands, such as 'security find-generic-password' to retrieve Wi-Fi passwords and 'caffeinate' to keep the Mac awake.

๐Ÿ’กPassword Manager

A password manager is a tool designed to securely store and manage login credentials for various online accounts. The video mentions Dashlane, a password manager, as a sponsor and discusses its features like password sharing, health monitoring, and dark web monitoring to ensure password security.

๐Ÿ’กUnix-based

Unix-based refers to operating systems that are built upon or are similar to the Unix operating system. The video points out that both Mac OS and Linux are Unix-based, which means they share many common commands, such as 'cd' for changing directories and 'ls' for listing directory contents.

๐Ÿ’กScreenshot

A screenshot is a digital image captured by a computer to record the visible contents displayed on the screen. The video discusses various Mac commands for taking and customizing screenshots, such as 'command + shift + 4' for selecting a portion of the screen and 'defaults write com.apple.screencapture name' to change the default screenshot file name.

๐Ÿ’กBrew

Brew, also known as Homebrew, is a package manager for Mac OS that simplifies the installation of software. The video script mentions installing Brew with a single command and using it to install additional tools and games, such as 'cmatrix' and 'tetris'.

๐Ÿ’กTouch ID

Touch ID is a fingerprint recognition feature on some MacBooks that allows users to unlock their devices or authenticate actions securely. The video describes how to configure the system to use Touch ID as a sudo password, enhancing the terminal experience by eliminating the need for typing a password for certain commands.

๐Ÿ’กPiping

Piping in a terminal context refers to the use of the pipe character '|' to direct the output of one command as the input to another command. The video demonstrates this with 'security find-generic-password | pbcopy' to copy a Wi-Fi password to the clipboard.

๐Ÿ’กCaffeinate

The 'caffeinate' command in Mac OS is used to prevent the system from going to sleep. The video uses this command to illustrate how to keep the Mac awake by running the command in the terminal, which is particularly useful for long-running processes or downloads.

๐Ÿ’กPBcopy

PBcopy is a command in Mac OS that copies the given data to the clipboard. The video mentions using 'pbcopy' in conjunction with other commands to easily copy output, such as passwords, to the clipboard for sharing or pasting elsewhere.

๐Ÿ’กNano

Nano is a simple, user-friendly text editor that can be used within the terminal. The video mentions using 'nano' to edit configuration files directly from the terminal, such as the '/etc/sudoers' file to enable Touch ID for sudo authentication.

Highlights

Launching a terminal on Mac OS is as simple as using Command + Space and searching for 'Terminal'.

Using the 'say' command in the terminal can make your Mac vocalize any text you input.

The 'security find-generic-password' command reveals all Wi-Fi passwords your Mac has ever used.

Piping commands with 'pbcopy' allows you to copy their output to the clipboard for easy sharing.

Command-Option-Shift-V is the shortcut for pasting text without formatting on a Mac.

The 'caffeinate' command can be used to prevent your Mac from going to sleep while the terminal is open.

Customizing screenshot names and file types can be done directly from the terminal.

Mac keeps a history of all downloads, which can be viewed and cleared using specific terminal commands.

Changing your Mac's password can be done directly from the terminal without navigating away.

Dashlane is highlighted as a secure password manager for personal and work use, with features like dark web monitoring and password sharing.

Mac OS and Linux share many similar commands due to their Unix-based nature, such as 'cd', 'ls', and 'pwd'.

The 'which' command helps identify the shell currently in use, and you can switch between shells like Bash and Zsh.

The 'uptime' command provides information on how long your Mac has been running.

Flushing DNS cache can be achieved through a series of terminal commands.

Using 'curl' in the terminal allows for downloading files directly from the command line.

Setting an alarm directly from the terminal with the 'at' command can help manage time spent in the terminal.

Disabling the Mac's gatekeeper with a single command can allow installation of apps that are otherwise restricted.

Homebrew, the missing package manager for macOS, can be installed and used to enhance the terminal experience.

Creative and fun terminal applications like 'cmatrix', 'Askie Aquarium', and 'toilet' can be installed via Homebrew.

Playing Tetris directly from the terminal is possible with the 'sam' package installed via Homebrew.

Python 3 comes pre-installed on Mac, and you can start a simple web server using 'python3 -m http.server'.

Using touch ID as your sudo password can be enabled by editing the '/etc/pam.d/sudo' file.

Transcripts

play00:00

Here are the top 50 Mac OS terminal commands you need to know.

play00:03

So get your coffee ready. This will take about 10 minutes. First,

play00:07

how do you launch a terminal? Hit the command key and space bar.

play00:09

Search for a terminal. There it is to enter and you're there.

play00:12

Let's do something fun first.

play00:13

We can actually make our Mac talk right from the terminal.

play00:16

Just type in say and whatever you want to say and.

play00:18

Whatever you want to say. Isn't that.

play00:20

Awesome? I mess with my kids a lot with this one.

play00:23

Did you know your Matt keeps a record of all the wifi passwords you've ever used

play00:26

and we can find those passwords right from the terminal. Check this out.

play00:28

The command is security find dash generic dash password,

play00:33

do a dash w and then the name of that wifi network. I haven't been here in ages,

play00:38

but there's the password right there.

play00:39

If I wanna quickly copy that and share it with a friend,

play00:42

run that command once more but do a pipe and type in PB copy and this will copy

play00:47

the output of any command to your clipboard allowing me to send Nick that

play00:52

password. And you can use PB copy with any command.

play00:54

Now I'm sure you know how to copy and paste on your Mac, highlight some texts.

play00:57

Command C and command V to paste. But often you don't want that format,

play01:01

you just want the plain text, the pace without formatting,

play01:03

command options shift and V plain text.

play01:06

And I know that wasn't the terminal but it's still pretty cool.

play01:08

How do you stay awake?

play01:10

Caffeine your Mac the same way and the terminal type in caffeinate and enter and

play01:14

as long as your terminal is up,

play01:16

your Mac will stay awake and then hit control C to stop coffee break for that.

play01:20

Taking screenshots on a mac is pretty easy. Command shift three,

play01:24

your whole screen and by default saves to your desktop. There it is.

play01:27

That's cool, but I kind of hate that. What I always do is command shift four,

play01:32

which allows me to select just part of what I wanna copy and saves it to the

play01:35

desktop. But even better, it's command control shift four.

play01:39

It's getting crazy and when you capture it, it goes to your clipboard.

play01:43

So I can tell Nick how awesome Dashlane is. There you go, Nick.

play01:46

And Nick does love using Dashlane. Don't you better say yes Nick,

play01:50

I'm gonna lock you in a liminal space.

play01:51

Now I know that wasn't a terminal command,

play01:53

but with the terminal you can change the default name of your screenshots cuz

play01:57

right now they're named random as you can see down here with this command.

play02:00

And this is kind of wordy, so I'll have all these commands below,

play02:02

but defaults right com, dot apple, dot screen, capture name,

play02:05

and then whatever you wanna name it. So now when I capture my screen,

play02:08

it'll name it exactly what we want.

play02:10

We can also change the default file type with the type option.

play02:12

Let's say we want JPEGs instead done.

play02:14

Or we can also change the location with the location option on where our

play02:18

screenshots are saved.

play02:19

Now don't get scared but your Mac does keep a history of everything you

play02:22

download. Like seriously, it's in a database.

play02:24

Use this command to see what you've downloaded and it's actually in a sequel

play02:26

light three database, kind of interesting.

play02:28

And right there it'll show you a lot of empty space,

play02:32

all the things you've downloaded, even if you clear your browsing history.

play02:35

So if you don't want Tim Cook or anyone else to know what you've been

play02:37

downloading, use this command to clear that stuff.

play02:39

Nothing there to change your password, you don't have to leave the terminal.

play02:42

Just type in P A S S WD or password and you can change your password.

play02:46

And then I'll go ahead and update my key chain user with that command they

play02:48

provide. And by the way, I have a different password for everything.

play02:52

You should too.

play02:52

And I know it seems impossible to manage but not with Dashlane sponsor of this

play02:57

video.

play02:57

Dashlane is the password manager I use for personal stuff and for my work stuff.

play03:01

In fact,

play03:01

I just shared a password with one of my new employees in the other room,

play03:04

which by the way,

play03:05

I don't know how I would've onboarded this new employee without dash lane.

play03:08

They make it so easy sharing passwords and logins and all kinds of stuff.

play03:11

Now personally it tells me my password health, I have some work to do.

play03:14

29 compromise passwords. Are your passwords compromised? You may not know,

play03:18

but thankfully Dashlane does do some dark web monitoring.

play03:21

They watch for you and I also have some work to do here, goodness.

play03:25

Now for my company I use Dashlane to manage all my employees passwords,

play03:28

making sure their passwords are healthy, that they're changing them,

play03:31

especially my new employees. I'm watching you Michael. Change your passwords.

play03:34

I'll show you too Nick.

play03:35

I can also see you what all my employees are doing as far as their password

play03:38

health. And then this by far is my favorite feature of Dashlane.

play03:41

Not only will they fill in your passwords right here in the browser,

play03:44

wherever you are, but they got two factor built in.

play03:47

All you gotta do is click it and then put it in done.

play03:49

So make sure you got a different password for every service and do it well with

play03:52

Dashlane. Check it out, link below and use my code network. Check 50,

play03:55

you'll get 50% off at checkout. Don't get hacked, do this.

play03:59

Now you may have known that Mac is very similar to Linux.

play04:01

They're both Unix based, which means a lot of the commands on Linux work on Mac.

play04:05

So let's take a quick coffee break and then I'll speed around.

play04:08

My favorite linnux commands I think you need to know for your Mac CD will change

play04:12

your current working directory.

play04:13

Type in CD where you want to go and you're there.

play04:15

Type in CD space to get back home.

play04:17

The LS command will list all the files of folders in your directory wherever you

play04:21

are. But where are you? Let's find out with the PWD command.

play04:23

We'll print your working directory. There I am. But who am I? .

play04:27

You can find out with the who am I command telling you exactly who you are.

play04:31

In case you forget,

play04:32

we can move files with the MV command specifying our file and where we wanna

play04:36

move it to.

play04:36

We can use the CP command to copy files specifying our file and where we want to

play04:40

copy it too. Mac OS actually has a better version of that called Ditto,

play04:44

which I love cuz well it's called Ditto and it works in a very similar way to

play04:47

the CP command.

play04:48

Use the DF dash H command to see how much space you have on your hard drive.

play04:51

Use the nano command to start editing a file right here in your terminal.

play04:55

No need to go anywhere and in control X,

play04:58

Y and enter to save and get out of there.

play05:00

Use the man command to learn about your commands, man. Sorry for that.

play05:04

I can man nano to find out what it is hitting Q to quit that I can, man. Man,

play05:09

I can use the open command too. Well uh, open things like the screenshot. Bam.

play05:13

Yes, I know you can click on it but it feels so much better opening it from a

play05:16

terminal, doesn't it? It does.

play05:17

If you wanna see if your favorite website is up and running,

play05:20

type in the ping command and then the name of the website.

play05:22

If you get responses then it's up it control C to stop that.

play05:25

What's your IP address? Type in if config, but maybe you can't find it like me.

play05:29

Try doing. If config and specifying the e N zero interface,

play05:34

this will work for most people. Now that's kind of messy.

play05:36

We'll do that same command but we'll do a pipe and use the grip command,

play05:39

which allows us to filter all what we wanna see. So I'll dore inet better,

play05:43

even better is the A command, another pipe type ink.

play05:47

And with some crazy regular expression stuff I get just the IP addresses,

play05:51

both IPV four and IPV V six to see the path through the internet that you're

play05:55

taking to get to a certain website, type in trace route.

play05:57

This one's really cool trace route the website you wanna see and we'll show you

play06:01

every router you hit, including the latency. Great for troubleshooting.

play06:04

If you want to dig into the DNS of a website, you can use the tool called dig.

play06:08

Dig the website name and you all the DNS goodness.

play06:11

If you wanna see all the processes on your computer, type in the PS command,

play06:16

which won't tell you a lot so you have to tell. You wanna see more,

play06:18

type in PS dash ax and you do get a lot more with the top command.

play06:22

You can see which processes are using the most CPU real time.

play06:26

You can also filter by memory by doing top dash o are size,

play06:30

seeing what's using the most memory on your computer.

play06:31

One of my favorite commands, the kill command will kill a running process.

play06:36

So I'll find my running process. I wanna kill with the PS command.

play06:38

I'll regret for the name, find my process id. There it is.

play06:42

And then I'll do kill dash nine and the process ID and I killed it.

play06:46

Speed round done. Now with the Mac o s terminal,

play06:48

you can use different types of shells. That's our next command.

play06:50

Find out what you're using with the which shell dollar sign. Shell command. Hey,

play06:54

we're using Zsh but you may not want to.

play06:57

We can switch to good old Bash by typing in Bash and suddenly we're in Bash

play07:00

world. Or we can switch back to Zsh with the eSSH command.

play07:04

And we're using Zsh again. How long has your Mac been up?

play07:06

We can find out with the uptime command. Seven days. Woo.

play07:10

It's a good boy to flush your DNS cash.

play07:11

You'll use these series of commands to make it happen.

play07:13

Put in your pseudo password and you're good to get a quick preview with the

play07:16

file. We can do that from the terminal.

play07:18

The QL managed command with the dash P and the file name little preview,

play07:22

just like that. If we want compare two files,

play07:24

we can use the diff command diff and the file names.

play07:27

We can also download files through our terminal with the curl command.

play07:30

Curl the URL you wanna download from.

play07:32

And then just use a right atic point to where you wanna store done entire BI

play07:37

downloaded. We can also curl the weather curl wtt,

play07:40

r i n slash and where you wanna be.

play07:42

If you're spending too much time in the terminal,

play07:44

you can set an alarm in your terminal.

play07:46

Type in leave and what time you want the alarm for. We'll say 1245 alarm set.

play07:50

And it tells you to leave because you have to be told to leave the terminal.

play07:53

It's too fun to see it history,

play07:55

all your commands because you've been typing a lot of commands type in history

play07:58

and there they are. This one's pretty handy cuz you can disable your gatekeeper.

play08:02

The thing on your Mac that keeps you from installing apps you want to install

play08:04

that might be insecure, but whatever. I know what I'm doing to do that.

play08:08

One simple command,

play08:09

pseudo SP CTL space dash master dash disabled.

play08:13

Put in your pseudo password, take that gatekeeper. Now.

play08:15

I would not do that for anyone that doesn't need it. Like your parents don't.

play08:20

Don't let them do that.

play08:20

Now here are where the commands get kind of crazy and fun and amazing,

play08:24

but we gotta do something first.

play08:25

We have to install brew because everything good starts with a good brew there.

play08:30

Check Coffee Brew is known as the missing package manager for Mac West.

play08:34

And you probably didn't know it was missing, but hey, we found it.

play08:36

Install it with one command. I'll have that below. It's kind of wordy.

play08:39

And let it do its thing. It might take a moment.

play08:40

So go ahead and take a little coffee break while your brew is brewing.

play08:43

Do your brew brew, brew some br, drink some coffee.

play08:46

And now we can have some fun. This first thing I wanna show you is crazy.

play08:49

Type in brew install C matrix. Once installed,

play08:53

simply type in C matrix and take the red pill.

play08:57

Neo . How cool is that? Pick control cda, exit the matrix.

play09:01

This next one is pretty cool too. Brew Install Askie Aquarium.

play09:05

And when installed, simply type in Askie Aquarium and go Fish. Dude,

play09:09

I could watch this all day. You ask a little ship going across. All right,

play09:12

control cda, get out. Toilet. Toilet. That's the name of this next one.

play09:15

That's kind of weird. Brew installed toilet. Fun fact.

play09:17

I used to sell toilets and once installed, you can turn any name, text,

play09:22

whatever into Askie character art like this Toilet network. Chuck.

play09:27

Ah, beautiful Toilet. Hi Nick. Hi Nick.

play09:31

That's just fun and I know you were wondering. Chuck,

play09:32

can I play Tetris and Terminal? The answer is yes. Duh.

play09:36

Brew install Sam t Tetris. Install it.

play09:39

And then simply type in Tetris. Choose your level and go to town.

play09:45

Yes, the terminal can do everything and more. Hit escape to get out of there.

play09:49

Now your Mac does have Python three installed by default. Python is amazing.

play09:53

Two amazing for me to tell you everything.

play09:55

But one thing you can do is start a little web server right from where you are.

play09:58

Type in Python three dash m htt t,

play10:01

no attp dot server. And suddenly you have a little web server on four 8,000,

play10:06

which means anybody on your network can go to your IP address

play10:11

on port 8,000 and browse your stuff.

play10:13

Which means you can easily share files just like that in case all the other

play10:17

stuff doesn't work. That's pretty cool, I think.

play10:18

Hit control seat and that web server.

play10:20

And when you're ready to shut down your computer,

play10:22

you don't have to leave the terminal,

play10:23

you can stay right here with the shut down command.

play10:25

Shut down dash H now for right now or dash R and now for a restart.

play10:29

And finally I save the best for last. This one's stinking cool.

play10:33

If you're like me, you're tired of typing in your pseudo password.

play10:36

If only we could just use our finger instead of pseudo. And that's what this is.

play10:40

You can use your touch ID on your MacBook as your pseudo password.

play10:43

Want to ask you for to do that, we'll type in pseudo first, type in nano,

play10:47

and we're going to edit the file slash et tc slash pam dotd slash pseudo.

play10:51

Put your pseudo password in for the last time and just below that first comment,

play10:54

add this line off sufficient pam underscore t i d

play10:59

dot. So control X, Y enter to save. Hit. Okay, and let's see if it works.

play11:04

Let's try one of our commands from earlier clearing our DNS cash. Here we go.

play11:07

That's killer. Best command ever. Video over buy.

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
Mac OSTerminal CommandsProductivityPassword ManagerDashlaneUnix CommandsSystem HacksPython ServerTouch IDBrew Install