13 Cool MacOS Terminal Commands You Should Know | Tips & Tricks

Chemicloud Web Hosting

Web Hosting

The Mac-OS is an often-neglected and overlooked feature. But there are so many Terminal you can use that makes the feature insanely useful.

If there is one piece of advice I can give to all users, it is this: Use the Terminal more. Seriously. It is an often-neglected and overlooked feature on the system. But there are so many cool Terminal commands you can use that makes the feature insanely useful.

It can be quite intimidating trying to use it if you are a newbie. Hollywood keeps pushing the stereotype of the Terminal window being used by hacker geeks spouting techno-babble, while shutting down the main power grid, while under heavy gunfire by terrorists. But it can also be used for more peaceful means such as customizing your Mac and using time-saving shortcuts.

After trying out loads of commands, here are the ones I liked the most.

13 Cool MacOS Terminal Commands To Try Out

I’ve excluded all the really geeky and techie ones. Instead, I am focusing on ones which are straightforward and useful. To open up the Terminal window, go to your Applications folder then “Utilities.” You will then find the Terminal.

View Hidden Files & Folders

As with Windows, MacOS hides all folders which are essential to the running of the system. By hiding them, there is no chance of you accidentally deleting a system-critical file and crashing your entire Mac.

But some files and folders do sometimes need to be seen. For example, on a USB stick, caches and thumbnails are usually hidden and they can take up quite a big part of the storage space. The only way to get rid of them, short of reformatting the stick, is to view the hidden files.

In a Terminal window, type :

defaults write com.apple.finder AppleShowAllFiles -bool TRUE

then type:

killall Finder

Now you will see all of the hidden files. But be careful what you delete. If in doubt, leave it alone.

To hide them again, repeat the command but replace TRUE with FALSE.

Download Files From The Internet Without a Browser

 

If you need to download a file from the Internet, you don’t always need to open a browser. You can also download it through the Terminal.

We have previously mentioned Homebrew which allows you to download software via the browser. There is also YouTube-DL where you can download YouTube videos via the Terminal as well (I love YouTube-DL).

But you can also download various bits and pieces online if you have the direct download link.  First, specify which folder you want it downloaded to. I have set it to the Downloads folder but you can change it to whatever you want.

cd ~/Downloads/

Then to download the file, type :

curl -O [the URL of the file]

Keep Your Mac Awake

There are various apps available for disabling the sleep function on a Mac. The one I use is the highly-rated free app Amphetamine. But if you are averse to installing lots of apps, there is actually a Terminal command you can use instead. Simply type:

caffeinate

This will stop your Mac from going to sleep. When you want it to finally close its digital eyes, you can relieve its suffering by pressing the CTRL + C buttons.

Play Tetris

 

I absolutely love Tetris. I can spend hours playing it. So I was delighted to learn there is a secret Tetris game hidden away on the Mac.

In the Terminal, type :

Emacs

Hit enter. Now tap the Fn and F10 keys together at the same time. Press the t button then the g button.

Finally, you will see this. Choose your game and it will start.

 

Make Your Mac Sound Like An iPhone When Plugged Into Juice

This is not really a useful one. But if you like the sound of your iPhone, you can now have your Mac make iOS beeps when you plug it into the power.

defaults write com.apple.PowerChime ChimeOnAllHardware -bool true; open /System/Library/
CoreServices/PowerChime.app

Tell Your MacOS To Check For Updates More Often

It’s common sense computer security to update your Mac often. But a lot of people frequently overlook it and take forever to download critical patches and updates. If this sounds like you, you can flip the finger to your Swiss cheese brain and instead tell your Mac to check for updates more often.

To tell it to check every day, just type:

defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

Change Where You Get Screenshots Sent To

 

In this line of work, I do a LOT of screenshots. When I bought my current Macbook a couple of years ago, it started sending all my screenshots to the desktop. It irritates the hell out of me as I like to keep a clean desktop. But there is a way to change the default screenshot location.

Just type the following, replacing /your/location/here with the path to the folder you want to change it to.

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

then type :

killall SystemUIServer

Create a New Default Name For Screenshots

 

Another cool screenshots one is changing the default name for a screenshot that the Mac makes.

Usually, the Mac writes it like this – Screen Shot 2018-09-11 at 20.00.46.png – but that is so unwieldy and ugly looking. But fear not. You can change it to whatever you want.

defaults write com.apple.screencapture name "New Screen Shot Name"

then type :

killall SystemUIServer

Change What Format You Make Your Screenshots

 

At this point, you’ve probably decided I’ve declared Holy War on screenshots. But I promise this is the last one I’ll do on it. As well as changing the default name and location, you can also specify what file format you want them in.

Usually, I do them in PNG format but a lot of my clients actually detest PNG. Instead, they want JPG. So since they are paying my bills, they get to decide what format my images are in. You can, of course, change it to whatever you want – GIF, BMP, or God forbid, TIFF.

defaults write com.apple.screencapture type jpg

Kill The Dashboard

When was the last time you used the Dashboard? Yup, me neither. In my opinion, there is absolutely no use for it and should be scrapped by Apple. But until they do get around to making it extinct, you can disable it instead.

defaults write com.apple.dashboard mcx-disabled -boolean TRUE

then type:

killall Dock

Add a Gap Between Apps In The Dock

 

This is one I really like because it brings a little bit of order to my Dock. It enables you to put blank spaces in the Dock so you can “separate” app icons and look as if they are grouped together.

defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'

then type:

killall Dock

View Your Entire Download History – And Wipe It

 

Privacy enthusiasts (and illegal downloaders) will be horrified to hear this one. Your Mac keeps meticulous records of every file you download. So the next time the Music Police come knocking on your front door, don’t bother protesting your innocence. Your Mac will snitch on you.

But you can get the last laugh. To view the entire list, type:

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 
'select LSQuarantineDataURLString from LSQuarantineEvent'

To delete all the incriminating evidence, type :

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from 
LSQuarantineEvent'

If you now type the first command again, the list should be blank.

Shut Down The Mac

Finally, when it’s time to go to bed, do your Mac a favor and let it go to sleep too.

$ sudo shutdown -h now

Or if it’s the middle of the day, and you need to restart your Mac, type :

$ sudo shutdown -r now

Conclusion

Do you have any favorite Terminal commands that I haven’t covered here? Let us know in the comments.

You might also like More from author

Leave A Reply

Your email address will not be published.