Return to site

Terminal Commands For Mac Os

broken image


Get all best apps via Setapp
  • View Hidden Files & Folders. As with Windows, macOS hides all folders which are essential to the.
  • How many times did you have something running on your Mac and you wanted to make.
Replace Mac defaults and discover new gems in one suite.

For those who have never used Terminal commands on Mac before, the app's resemblance to hacking (as seen in movies) can be a little intimidating. But in fact, Terminal isn't all that complicated once you know a little about how it works.

Many commands are surprisingly straightforward, such as how to open a file in Terminal and the dangerously powerful (since it bypasses the Trash) Terminal delete file capability:

Terminal (officially called Terminal.app) is, strictly speaking, an emulator and works off most typical UNIX commands (OS X is a UNIX-based system, as opposed to Windows, which is NT-based). Unlike OS X, which has a graphical user interface (shortened to GUI), Terminal works off a text-based interface and all commands have to be typed in - this. Just like Windows, Mac also comes with its own command prompt line interface, Terminal application (Unix commands). Learning about the Terminal app could come in handy and will help you go deep in Mac OS settings with ease. Not only this, there are other reasons too.

open ~/Desktop/filename.extension

rm filename.extension

The rm stands for remove, so use with caution!

For another example, let's look at how to create a folder on Mac. Using Finder, this would simply be a case of right-clicking and choosing New Folder. When it comes to how to make a directory in Terminal, we'd need to use a specific command:

mkdir 'new folder'

The Terminal window itself is designed to grant users access to UNIX features hidden away behind the Mac operating system. But you don't need to learn about all of the technical stuff if you don't want to. All you need to know is that a bit of Mac command line rote learning can help you do all sorts of cool things with your laptop or desktop that you couldn't achieve otherwise.

Fix Mac problems without Terminal

Terminal commands aren't easy. With Setapp, a one-stop platform for Mac apps, you can do the same — or more — in a beautiful interface.

8 Best Terminal Commands For Mac

Of course, defining the best Terminal commands for Mac really depends on what you want to get out of this tool. First things first though, to start you need to know how to open command prompt on Mac because you can't use any Terminal commands without it:

  1. Double-click your Macintosh HD icon or open a Finder window

  2. Make your way into the Applications folder

  3. Double-click Utilities and open Terminal

You'll be met with a window that shows the name of your Mac followed by your username and a $ sign. All of the Mac Terminal commands listed here are entered after this, followed by a press or two of the Return key.

Actually using the app may be a bit tricky if you've never done so before, but at least the question of how to open Terminal on Mac is easy to answer. Pay attention going forward!

1. Show or hide files and folders

Mac

One of the easier, and most useful, commands to use in conjunction with Mac command line is the one that reveals hidden files and folders in macOS:

defaults write com.apple.finder AppleShowAllFiles -bool TRUE

killall Finder

Now you can edit and delete files that were previously inaccessible. When you want to hide these files again, just change the TRUE above to FALSE and repeat the process.

2. Duplicate files between folders

Rather than dragging and dropping or copying files between folders, you can use Ditto Terminal command on Mac to achieve the same result:

Ditto [original folder] [new folder]

If you have folders in different locations with the same name, you can type -v after Ditto to display each item's file path using the verbose mode of Mac Terminal.

Terminal Commands For Mac Os

3. Change default screenshot settings

Tired of clogging up your desktop with screenshots? Terminal on Mac offers an easy fix for that with the option to set a new location for screenshots to be saved. Just enter the following:

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

killall SystemUIServer

Apple Terminal Commands List

You can also change the default file format (PNG) if you want to generate screenshots as JPEGs or PDFs instead:

defaults write com.apple.screencapture type jpg

4. Improve the screenshot process

If you take a lot of screenshots on your Mac, you might have noticed that it automatically adds a drop shadow to screenshotted windows. If you'd prefer to turn these shadows off, you can do so with the following Mac commands:

$ defaults write com.apple.screencapture disable-shadow -bool TRUE

killall SystemUIServer

To further customize how screenshots appear on your Mac, you could look at CleanShot. This app allows you to capture your Mac's screen without the distraction of desktop icons, set custom wallpapers on the background, and annotate or blur certain parts of the image.

After taking a screenshot with CleanShot, a small popup window allows you to tweak the appearance of your capture — such as adding shapes, text, or pixelating parts of the image — before you share it anywhere using a layout similar to the simple and intuitive actions in Preview.

Mac Commands For Terminal

5. Download files without using your browser

The art of downloading files without using a web browser is familiar to any millennials who risked malware and viruses to download their favorite tracks from Limewire or Kazaa, but may be unheard of to others.

A nifty Mac command line trick exists for downloading files without using your web browser if you already know the location of the file. The command is as follows:

cd ~/Downloads/

curl -O http://website.com/folder/file..

The first part is a crash course in how to change directory in Terminal, as that's what the cd stands for. So by re-reading the example above, you can see that the file will appear in your Downloads folder when it's finished downloading.

6. Keep your Mac awake

Overriding your Mac's default sleep settings (available via System Preferences ➙ Energy Saver) is a breeze using one of Terminal's more humorous Mac commands. Mbr for mac. Apparently, like so many people out there, Macs run on coffee:

caffeinate -u -t [number of seconds to remain active]

If you'd rather not launch Terminal every time you need to keep your Mac awake, there's an app out there called Lungo that lives in your menu bar and builds on the coffee theme. Just select the cup icon in the top right corner of your screen and you can keep your Mac awake for 10 minutes, 30 minutes, 1 hour, 4 hours, or indefinitely with a single click.

7. View the contents of any folder or file

If one of your files gets corrupted, or you suspect there's a hidden message tucked away somewhere inside its package, you can use the Terminal window to see some details about it:

cat ~/file/path/here

The command will throw out a bunch of indecipherable nonsense if you try to use it on something like an image or an audio file, but it could be a lifesaver when recovering text from a corrupted Word document, for example.

8. Hide inactive apps in Dock and dull hidden ones

Accruing more and more apps in your Dock is pretty much par for the course when you use a Mac for any significant length of time. So a good-to-know Terminal command here is the one that makes your Dock embrace a minimal approach by showing only active apps:

defaults write com.apple.dock static-only -bool TRUE

killall Dock

If you want to take this process even further, you can dim apps that aren't visible on your monitor(s):

defaults write com.apple.Dock showhidden -bool TRUE

killall Dock

Another easier option for those with the cluttered Dock is to check out uBar, a simple and minimal replacement. Instead of a long line of icons, you can now have a highly customizable bar that allows you to devote more space to the apps that matter most.

You can use uBar to preview, group, quit, or close apps and windows, without the need to open them first, across multiple monitors. It's an altogether less distracting option for those who find the default Dock a bit cluttered or unpredictable.

Best terminal commands mac

Best Terminal for Mac alternatives

If you simply can't get to grips with how to open Terminal on Mac or get comfortable with all of its ins and outs, you may want to investigate an app like MacPilot.

Get a perfect Terminal alternative

Install MacPilot, an appealing tool that will replace Terminal on your Mac. Over 1000 hidden macOS features and ease of use.

MacPilot grants access to more than 1,000 hidden features in macOS using UNIX without requiring that you learn any complicated commands. Instead, it offers users a Finder-esque window that groups tweaks by both application and function.

In most cases, enabling or disabling features with MacPilot is as simple as checking or unchecking the relevant boxes. You can also explore content across your disks using a File Browser that includes hidden files and detailed information about all available items.

The range of System Tools, reference guides, and secret tricks offered by MacPilot is a powerful alternative to Terminal for those who would rather avoid struggling with commands.

Terminal

Why the Terminal window still matters

Try to wax lyrical about the benefits of Mac commands with fellow Apple users and there's a good chance you'll be met with them asking 'what is a Terminal?' The fact is, this app isn't something that the average Mac user ever bothers much with.

As you can see from the list of useful commands above, neglecting to use Terminal on Mac or an app like MacPilot means never seeing everything that your laptop or desktop is capable of.

One of many great things about using Mac Terminal commands is that, should you make a mistake, you can usually undo whatever you've done just by changing TRUE to FALSE and running the command again or simply changing the location or setting back to what it was before.

It's true that Mac Terminal has a steep learning curve if you're not used to its 'language' but, whether or not you take the easier route with MacPilot, you can still try some of the cool tricks Terminal allows. You can play games, for example, by doing the following:

  1. Open a Terminal window and type emacs then press Enter

  2. With GNU Emacs selected, hit Escape

  3. On the next screen, type x then tetris, pong or snake and press Enter

The most interesting example of a hidden Mac Terminal trick? That has to be the option to watch an ASCII version of the entire movie Star Wars:

telnet towel.blinkenlights.nl

Grab some popcorn and enjoy!

Best of all, the apps mentioned throughout this article: CleanShot, Lungo, uBar, MacPilot — are all available for a free 7-day trial with Setapp, a platform for more than 150 apps to extend the possibilities of your Mac. See the best your Mac can do.

Terminal Commands For Mac Os

Setapp lives on Mac and iOS. Please come back from another device.

Meantime, prepare for all the awesome things you can do with Setapp.

Terminal Commands For Mac Os

One of the easier, and most useful, commands to use in conjunction with Mac command line is the one that reveals hidden files and folders in macOS:

defaults write com.apple.finder AppleShowAllFiles -bool TRUE

killall Finder

Now you can edit and delete files that were previously inaccessible. When you want to hide these files again, just change the TRUE above to FALSE and repeat the process.

2. Duplicate files between folders

Rather than dragging and dropping or copying files between folders, you can use Ditto Terminal command on Mac to achieve the same result:

Ditto [original folder] [new folder]

If you have folders in different locations with the same name, you can type -v after Ditto to display each item's file path using the verbose mode of Mac Terminal.

3. Change default screenshot settings

Tired of clogging up your desktop with screenshots? Terminal on Mac offers an easy fix for that with the option to set a new location for screenshots to be saved. Just enter the following:

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

killall SystemUIServer

Apple Terminal Commands List

You can also change the default file format (PNG) if you want to generate screenshots as JPEGs or PDFs instead:

defaults write com.apple.screencapture type jpg

4. Improve the screenshot process

If you take a lot of screenshots on your Mac, you might have noticed that it automatically adds a drop shadow to screenshotted windows. If you'd prefer to turn these shadows off, you can do so with the following Mac commands:

$ defaults write com.apple.screencapture disable-shadow -bool TRUE

killall SystemUIServer

To further customize how screenshots appear on your Mac, you could look at CleanShot. This app allows you to capture your Mac's screen without the distraction of desktop icons, set custom wallpapers on the background, and annotate or blur certain parts of the image.

After taking a screenshot with CleanShot, a small popup window allows you to tweak the appearance of your capture — such as adding shapes, text, or pixelating parts of the image — before you share it anywhere using a layout similar to the simple and intuitive actions in Preview.

Mac Commands For Terminal

5. Download files without using your browser

The art of downloading files without using a web browser is familiar to any millennials who risked malware and viruses to download their favorite tracks from Limewire or Kazaa, but may be unheard of to others.

A nifty Mac command line trick exists for downloading files without using your web browser if you already know the location of the file. The command is as follows:

cd ~/Downloads/

curl -O http://website.com/folder/file..

The first part is a crash course in how to change directory in Terminal, as that's what the cd stands for. So by re-reading the example above, you can see that the file will appear in your Downloads folder when it's finished downloading.

6. Keep your Mac awake

Overriding your Mac's default sleep settings (available via System Preferences ➙ Energy Saver) is a breeze using one of Terminal's more humorous Mac commands. Mbr for mac. Apparently, like so many people out there, Macs run on coffee:

caffeinate -u -t [number of seconds to remain active]

If you'd rather not launch Terminal every time you need to keep your Mac awake, there's an app out there called Lungo that lives in your menu bar and builds on the coffee theme. Just select the cup icon in the top right corner of your screen and you can keep your Mac awake for 10 minutes, 30 minutes, 1 hour, 4 hours, or indefinitely with a single click.

7. View the contents of any folder or file

If one of your files gets corrupted, or you suspect there's a hidden message tucked away somewhere inside its package, you can use the Terminal window to see some details about it:

cat ~/file/path/here

The command will throw out a bunch of indecipherable nonsense if you try to use it on something like an image or an audio file, but it could be a lifesaver when recovering text from a corrupted Word document, for example.

8. Hide inactive apps in Dock and dull hidden ones

Accruing more and more apps in your Dock is pretty much par for the course when you use a Mac for any significant length of time. So a good-to-know Terminal command here is the one that makes your Dock embrace a minimal approach by showing only active apps:

defaults write com.apple.dock static-only -bool TRUE

killall Dock

If you want to take this process even further, you can dim apps that aren't visible on your monitor(s):

defaults write com.apple.Dock showhidden -bool TRUE

killall Dock

Another easier option for those with the cluttered Dock is to check out uBar, a simple and minimal replacement. Instead of a long line of icons, you can now have a highly customizable bar that allows you to devote more space to the apps that matter most.

You can use uBar to preview, group, quit, or close apps and windows, without the need to open them first, across multiple monitors. It's an altogether less distracting option for those who find the default Dock a bit cluttered or unpredictable.

Best Terminal for Mac alternatives

If you simply can't get to grips with how to open Terminal on Mac or get comfortable with all of its ins and outs, you may want to investigate an app like MacPilot.

Get a perfect Terminal alternative

Install MacPilot, an appealing tool that will replace Terminal on your Mac. Over 1000 hidden macOS features and ease of use.

MacPilot grants access to more than 1,000 hidden features in macOS using UNIX without requiring that you learn any complicated commands. Instead, it offers users a Finder-esque window that groups tweaks by both application and function.

In most cases, enabling or disabling features with MacPilot is as simple as checking or unchecking the relevant boxes. You can also explore content across your disks using a File Browser that includes hidden files and detailed information about all available items.

The range of System Tools, reference guides, and secret tricks offered by MacPilot is a powerful alternative to Terminal for those who would rather avoid struggling with commands.

Why the Terminal window still matters

Try to wax lyrical about the benefits of Mac commands with fellow Apple users and there's a good chance you'll be met with them asking 'what is a Terminal?' The fact is, this app isn't something that the average Mac user ever bothers much with.

As you can see from the list of useful commands above, neglecting to use Terminal on Mac or an app like MacPilot means never seeing everything that your laptop or desktop is capable of.

One of many great things about using Mac Terminal commands is that, should you make a mistake, you can usually undo whatever you've done just by changing TRUE to FALSE and running the command again or simply changing the location or setting back to what it was before.

It's true that Mac Terminal has a steep learning curve if you're not used to its 'language' but, whether or not you take the easier route with MacPilot, you can still try some of the cool tricks Terminal allows. You can play games, for example, by doing the following:

  1. Open a Terminal window and type emacs then press Enter

  2. With GNU Emacs selected, hit Escape

  3. On the next screen, type x then tetris, pong or snake and press Enter

The most interesting example of a hidden Mac Terminal trick? That has to be the option to watch an ASCII version of the entire movie Star Wars:

telnet towel.blinkenlights.nl

Grab some popcorn and enjoy!

Best of all, the apps mentioned throughout this article: CleanShot, Lungo, uBar, MacPilot — are all available for a free 7-day trial with Setapp, a platform for more than 150 apps to extend the possibilities of your Mac. See the best your Mac can do.

Terminal Commands For Mac Os

Setapp lives on Mac and iOS. Please come back from another device.

Meantime, prepare for all the awesome things you can do with Setapp.

Read on

Sign Up

Setapp uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy.

Terminal is not for mere mortals, you're probably thinking. It's a kind of a sacred knowledge that only geeks and Mac geniuses possess. But if you get through your first command line you'll find it's not that terrifying. In fact, using Terminal is like applying Harry Potter wizardry to your tasks. Once you know the right spells you can break any laws of how applications behave and do some unbelievable things that even the most experienced Mac people can't. Isn't it seducing to try?

We've chosen just a few of Terminal's most impressive features. For more serious take on Mac terminal commands, check out this article. Okay, are you ready to type in your first code? To start the journey, learn how to open Terminal app on Mac: Click Launchpad and then type Terminal in the search bar.

1) Make your Mac talk to you

One of the simplest commands which can be very fun, especially when you are planning a prank on somebody. Just type any text in Terminal and your computer will speak it in your Mac's default voice. But there's about 20 voices and intonations to choose from plus the ability to convert an entire text file into speech. So here's a slick audiobook maker at your hand.

Open up Terminal, type in:
say followed by a space and any text you want to hear

2) Customize Login Message

This is what makes Mac more personal and humanized. For example, you can write an inspirational motto or helpful information for other users, if it's a public library computer. It might even be a way to retrieve your MacBook if you lose it — if you set a login message with your contact information. Once again there's much room for pranking other people, but we won't go deep into that.

Open up Terminal, type in:

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

3) Watch Star Wars in Terminal app

In Terminal symbols, of course. This could be the greatest trick which makes no particular sense, but even if just for the coolness alone you should try it. The Death Star, R2D2, spaceships and the rest of the Episode 4 story retold in Terminal graphics will blow your friends away at the party. And there is no sound by the way.

Open up Terminal, type in:
telnet towel.blinkenlights.nl
On macOS Sierra and higher macOS versions, you should use a different command:

nc towel.blinkenlights.nl 23

4) Show hidden files in Finder

This isn't as funny as the previous one, but searching for important files is no joke. With this command, you'll be able to see everything on your Mac, even files which were omitted from standard display.

Open up Terminal, type in:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

This should summon Finder with previously hidden files shown grayed out.
To reverse this operation (be aware that you may be swamped with lots of irrelevant system files) just substitute TRUE for FALSE in the command line above:

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

5) Pay a visit to a psychiatrist

Funny Mac terminal commands are many. This is a classic Easter egg type of joke macOS developers are famous for. When you're feeling stressful, talking to friendly chatbot will at least make you smile. Strangely enough, this therapy may be actually working because you are asked to verbalize your emotions, by giving them a closer look. And the psychiatrists (the real ones) will confirm that sometimes it works.

Open up Terminal, type in:
emacs and then hit Return. Press Esc, then x, and finally type doctor

6) See iTunes songs notification via Terminal app

A clever addition if you normally work with the music on the background. If you fell in love with a particular track from your playlist you don't need to open iTunes to find out the artist's name. It will pop up on your Mac Dock from now on. Though a bit strange this feature isn't included by default because it's really a timesaver.

Open up Terminal, type in:

defaults write com.apple.dock itunes-notifications -bool TRUE

Close the dock using the following command:

killall Dock

7) Play simple games

This is another retro cool feature to cheer you up once in a while. You can play Tetris, Pong, Snake and a dozen of other arcade games. Once you have unlocked these nice hidden toys, you'll surely get to love your Mac more. Prepare to use your arrow keys.

Open up Terminal, type in:
emacs. Press Enter to open it up, press Esc then x. Now you have to type the name of the particular game and that's it.
Game names:

  • tetris
  • pong
  • snake
  • solitaire
  • 5x5
  • landmark
  • doctor

What you learn from using Mac Terminal commands is that nothing is really impossible if you're on a Mac. But it's better to start your Terminal experience with these funny little tricks and then go to something serious. This program has a nearly infinite number of magic spells to choose from.

8) Make your Mac faster and more responsive

Okay, this has nothing to do with Terminal. But who wouldn't want their MacBook as speedy and efficient as back then, on its first day? Surprisingly, this can be achieved easily, Terminal-style way — with aid of CleanMyMac X.

  • Remove up to 74 GB of junk from your Mac
  • Uninstall unwanted apps completely
  • Speed up Mac with maintenance scripts
  • Fully clean browsers and messengers

Download the app from developer's site for free
Hope you found this article helpful, stay tuned for more!

These might also interest you:





broken image