Impress Your Friends With These Fun and Useful Mac Terminal Commands

May 28, 2020

Photo by [Ash Edmonds](https://unsplash.com/@badashproducts?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral).Photo by Ash Edmonds on Unsplash.

We always want to know things that most people don’t. If you know something that only a few people do, you feel great about yourself. Here are eight fun commands that most people aren’t aware of.

1. Make Your Mac Talk to You

Yes, your Mac can talk to you. Whatever you say, it will repeat it.

say “I am Groot”

say “I am great at impressing people”

The say command will dictate whatever sentence you enter between the double quotes in the default system voice.

You can also change the voice by going to System Preferences → Accessibility, → Speech → System Voice pop-up menu, and then choosing a voice.

It’s a cool terminal command to prank others with.

2. Make Your Mac Restless

If you’re not performing any interaction with your Mac, then it will enter into sleep mode to save energy. But in some cases, like when taking notes or reading a long article, you may forget to interact with your Mac and then have to enter your password to log in again. To prevent your Mac from falling asleep, you can use the caffeinate command:

caffeinate

We can also set time periods up so the command is only active for a temporary period of time.

To do this, add the -t flag followed by the number of seconds you want the feature to be enabled for:

caffeinate   -t 600

The command above will make your Mac not enter the sleep state for 10 minutes (600 seconds). It can be stopped before then by pressing ctrl + c.

3. Download YouTube Videos From Your Terminal

If you want to download YouTube videos, your Mac terminal can do that in a single command. To do this, you need to install youtube-dl:

brew install youtube-dl

Once youtube-dl is installed, you can download any YouTube video as follows:

youtube-dl "video-url"

There are many options available. You can refer to the documentation for more information.

4. Shut Down Your Mac

If you want to shut down your Mac using the terminal, all you need to do is type this command:

sudo shutdown -h now

Then enter your password. This will shut down your computer.

To restart the computer:

sudo shutdown -r now

To shut down your Mac after a certain period of time, you can use this:

sudo shutdown -h +60

The command above will shut down the machine in 60 minutes.

Refer to this page for even more options to shut down your Mac.

5. Make Your Mac Motivate You With a Custom Message

Mac allows you to set a custom login message. You can write a motivational quote, or if you want to convey some message to someone using your computer, then this is a great choice. I added my address and mobile number on the login screen, so even if I lose my Mac, it would be easy for the person who found it to contact me.

sudo write /Library/Preferences/com.apple.loginwindow LoginwindowText "Custom Text Here"

This will ask for your administrative password. That’s it. For more detailed info, refer to this page.

6. Make Your Mac Display the Weather Forecast

You don’t need to use a browser to get the weather forecast. You can do it from your terminal with a single-line command:

curl http://wttr.in/

It will bring you the weather forecast for the upcoming three days, with Morning, Noon, Evening, and Night sections.

This will be really helpful if you’re a frequent traveler.

To get the weather report for a particular city, you can use:

    curl wttr.in/London

7. Get the History

You can get your terminal command history using:

history

If you’re searching for a specific word from the command history, then you can use:

history | grep cd

The command above will list all the commands in the history that include cd.

If you want to clear the command history, then you can use:

    history -c

8. Change Save Location of the ScreenShot

If you want to save your screenshot in a custom location, you can use this command:

defaults write com.apple.screencapture location ~/your/location/here

After this, enter another command:

killall SystemUIServer

That’s it.

Thanks for reading.

Please donate here, for making more tutorials.