How to use macOS Terminal and what it’s useful for

Sep 17, 2024 10:51 PM - 3 months ago 138148

With each operating strategy update, our computers get further distant from their earliest, text-based interfaces, erstwhile copying files and launching programs required typing retired circumstantial commands alternatively than double-clicking connected icons. But though a batch of today’s users won’t cognize these bid statement interfaces ever existed, and others will person forgotten each astir them, they’re still coming successful macOS and successful Windows. More than that, they’re still really useful. 

In this article, I’ll look astatine immoderate ways you tin entree and usage Terminal, a throwback to the days earlier macOS. There are 2 ways of launching it:

  • In Spotlight, commencement typing Terminal, and erstwhile Terminal.app comes up, deed return.
  • In Finder, spell to the Utilities files (you’ll find that successful Applications) and look for Terminal.app

There are a assortment of commands you tin usage successful Terminal. What follows are 9 commands that make it worthy firing up. Simply type them successful astatine the punctual and deed Enter to confirm. To get much accusation astir immoderate command, usage the pursuing syntax, replacing “command” pinch the sanction of the circumstantial bid you’re willing successful (and support the quotes):

Terminal model showing the caffeinate function.

Terminal tin thatch you much astir its commands.

Screenshot: Apple

1. Change really screenshots are saved

defaults constitute com.apple.screencapture sanction “New Screen Shot Name”

By default, screenshots usage the record sanction format “Screen Shot [date] astatine [time].png” and are saved connected the desktop. Using the Terminal bid above, changing “New Screen Shot Name” to the record of your choice, you tin alteration this format.

The day and clip will still be included, but the “Screen Shot” portion will change. It tin beryllium useful if you’re putting together a batch of screenshots for 1 peculiar intent that you request to support separate.

2. Keep your Mac awake

caffeinate -t <length of time>

You tin ever alteration your Mac’s powerfulness settings done the Lock Screen sheet successful System Settings, but utilizing the Terminal tin beryllium quicker, particularly for impermanent tweaks. Use the bid supra to support your strategy awake for the specified magnitude of clip successful seconds (so 300 would adjacent 5 minutes).

You tin besides usage the “caffeinate” bid connected its own, which will put disconnected slumber mode until the Terminal model is closed. It tin beryllium useful if you’ve sewage lengthy tasks aliases downloads connected the spell connected your Mac and don’t want them to beryllium interrupted.

3. Get elaborate strategy position readings

The elemental “top” bid tin beryllium utilized arsenic an replacement to the Activity Monitor successful macOS, giving you a wealthiness of real-time stats astir the authorities of your system, including really overmuch CPU clip and representation each exertion is using. It’s awesome for getting a quick, at-a-glance overview of the strain your Mac is under.

Terminal model pinch lists of various commands.

Get a reference connected the position of your macOS system.

Screenshot: Apple

4. Force-quit apps

Being capable to force-quit applications from the Terminal model tin beryllium useful successful each kinds of troubleshooting scenarios, particularly if the remainder of your strategy has frozen. Just switch “AppName” pinch the sanction of the app to unopen down, without the quotes. For example, “killall Finder” would force-quit the Finder interface.

5. Put a connection connected the login screen

sudo defaults constitute /Library/Preferences/com.apple.loginwindow LoginwindowText “Custom Text Here”

Use the bid supra and switch “Custom Text Here” (while keeping the quotes) to put a connection connected the macOS login screen. Maybe you want to time off yourself a motivational connection to commencement each time aliases possibly you want to put your email reside onscreen successful lawsuit your MacBook gets lost.

To region the message, tally the bid again pinch thing betwixt the quotation marks.

6. Shut down aliases restart your Mac

sudo shutdown -h now

sudo shutdown -r now

The commands listed supra will either unopen down (top) aliases restart (bottom) your Mac, which you whitethorn find easier than going done the menus. Even better, you tin adhd a number astatine the extremity of the connection to do a timed restart aliases shutdown (which is useful if you’re going to beryllium distant from your computer. For example, “sudo shutdown -r +10” will restart your machine successful 10 minutes’ time.

Terminal model pinch 2 calendars.

Terminal tin show a almanac for immoderate period you’d like.

Screenshot: Apple

7. Show a elemental calendar

The “cal” bid will bring up a basal almanac onscreen showing the existent month, which tin beryllium adjuvant for quickly checking days and dates. The usability really comes into its ain erstwhile you request circumstantial months and years — “cal 1980” will show you a almanac for 1980, for example, while “cal 1 2030” will show you a almanac for January 2030 (just usage the number of the period to specify it).

8. Software update

softwareupdate -l

sudo softwareupdate -i -a

There are various clever Terminal commands you tin usage for updating the macOS operating system. The first successful the database supra checks for updates for macOS, while the 2nd installs immoderate disposable updates. (You tin besides specify circumstantial update names alternatively of the “-a” flag.)

Terminal model supra dock pinch other abstraction successful it.

You tin adhd spaces to the dock utilizing Terminal and right-click to region them.

Screenshot: Apple

9. Change the dock spacing

defaults constitute com.apple.dock persistent-apps -array-add ‘{“tile-type”=”spacer-tile”;}’; killall Dock

This is simply a classical illustration of the under-the-hood tweaks that Terminal is really bully at: usage the syntax above, and you’ll find a blank tile is added to the dock, giving you immoderate abstraction betwixt your app shortcuts.

You tin resistance the abstraction astir the dock and transportation connected adding other ones arsenic needed. To get free of a separator you’ve added, right-click connected it and take Remove from Dock.

That’s it for now. If you usage Terminal successful different ways to make things faster aliases easier, fto america cognize successful the comments!

More