Best Terminal Command Tricks and Tips for Mac Users – Guide
Terminal, a line interface for macOS, provides access to UNIX functions outside the macOS skin. To get started with Terminal and its commands, check out our introductory post: How to Use Terminal on a Mac. Once you’ve got the basics down, try some of these projects in Terminal.
1. Open the folders
Using Terminal to open files and folders is a great way to get started with the command line. It’s an easy and secure way to access specific files or folders without revealing their file structure.
To access the Documents folder, type the command and press Enter.
Users can access their documents by opening the “Documents” folder on their computer.
Users can open a DOCX file in their Documents folder using Terminal by entering the command with the path of the file.
A new application, “Application Name,” is now available for download at a specified path.
A Mac user opened a DOCX file in their Documents folder by typing a command and hitting Enter.
Prajith opened Microsoft Word to access his document, “SoP_Prajith_New.docx.”
Using the wildcard character (* .extension) instead of the full file name can open a specific file with a predefined program, but having multiple files with the same extension can cause Macs to freeze.
2. Change the default location for saving the screenshot
Mac users can now avoid cluttering their desktop with screenshots, as macOS Mojave allows them to change the save location for these images. This is especially useful for those who have enabled iCloud sync, as the uploads will continue to their account.
Type the command and press Enter to execute it.
Mac users can now save screenshots directly to their Downloads folder by changing the default location in their system settings.
You can specify a different file location than the default Downloads folder when executing the command.
To apply changes immediately, enter the command “reset SystemUIServer” after pressing Enter.
I advise restarting your Mac, although it is not required.
3. Change the image type of the screen capture
MacOS users can quickly switch their screenshot format from JPG to PNG or PDF by using a specific command.
Apple’s macOS now allows users to save screenshots in the PNG file format. The feature is enabled by entering a specific command into the Terminal app.
You must shut down the SystemUIServer to make any changes to your system. Do this quickly for best results.
Screenshots taken with your new software will now be saved as PNG files, which take up more storage space than JPGs. Be mindful of this when saving images.
4. Show hidden files
If you’re looking to show hidden files on Mac, it’s not as straightforward as Windows. But don’t worry - there’s a simple command that can help you out in no time.
The Finder app on Apple devices can be set to show all files by entering the command “defaults write com.apple.finder AppleShowAllFiles -bool TRUE” into the terminal.
You must shut down the Finder to complete the process.
Reversing the command to change TRUE to FALSE will make hidden files in the Finder no longer visible.
5. Unplug the panel
Apple’s Dashboard view, which provides quick access to the Calculator and Sticky Notes apps, is rarely used. To avoid accidentally opening it, users can turn it off and instead use Spotlight’s Mission Control to open the Calculator or Sticky Notes apps.
To disable the Dashboard, users can enter the command “defaults write com.apple.dashboard mcx-disabled -boolean YES” into their Mac’s Terminal.
Apple has disabled the Dashboard feature in its latest software update, requiring users to manually turn it back on if they wish to use it.
To ensure the changes take effect, you must shut down the Dock.
No longer do I have to fear mistakenly accessing the Dashboard. To reactivate it, simply switch the “TRUE” setting to “FALSE” on the remote.
6. Download files
Terminal users can download files without a browser, as long as they have the download link. The command syntax is:
The command line tool curl can be used to download files from a given link.
Navigate to the Downloads directory to download the file.
Users can access their downloaded files quickly and easily by navigating to the “Downloads” folder in their home directory.
Users can quickly and easily download VLC media player for macOS by entering the command “VLC for macOS” into their web browser.
Download the latest version of VLC media player for Mac by entering the command “curl -O https://get.videolan.org/vlc/3.0.7.1/macosx/vlc-3.0.7.1.dmg" into your terminal, noting that there is an uppercase letter “O” and not a zero in the command line.
7. Ditto for backups
Copying large amounts of data on macOS can be time-consuming, but Terminal’s ‘cp’ command can help speed up the process. This command allows users to quickly copy files while viewing the names of those being copied.
Duplicate the contents of the current path to a new path.
Copy the DMG file from the previous step to your desktop.
Move the VLC 3.0.7.1 download from the Downloads folder to the Desktop.
Copy the files to an external drive by supplying the correct destination path.
8. Always show the file path in the Finder
Mac users who have recently switched from Windows may be surprised to find that the Finder in macOS does not display a file path like Windows Explorer. Fortunately, they can force the Finder to show the path by entering a simple command.
The Finder app on Apple devices can now display the full path of a file in its title bar, thanks to a new setting that enables users to toggle this feature on or off.
Once you hit enter, it’s time to shut down the Finder.
Once you hit Enter, the Finder will restart and display the file paths at the top of its window.
9. Power signal when connecting the charger
Do you ever forget to turn on the power button when connecting your Mac’s MagSafe charger? I know I have. But now, thanks to a handy command, I get an audio chime every time I plug it in - so no more missed connections!
Enter this command into the Terminal to execute it.
Apple users can now enable the PowerChime feature, which plays a sound when their device is plugged in, by entering a command into their terminal and opening the PowerChime app.
10. Stop your Mac from hibernating
To prevent your Mac from going to sleep while downloading a large file, type the following command and press Enter. Then, you can exit the device.
Caffeine can keep your computer awake for up to 10 hours, allowing you to work uninterrupted.
Entering the command “caffeine” or a number of seconds into your Mac will prevent it from sleeping for up to 10 minutes.
If you close the Terminal window, your Mac will hibernate at a predetermined time.
11. Check your Mac’s uptime
If you’re looking to check how long your Mac has been running since its last restart, a simple command can help. Restarting your Mac can help organize things and improve performance, so it’s useful to know how much time has passed since the last restart.
A timestamp has been provided for all details.
Final note
We’ve created a guide to help Mac users get the most out of their terminals. If you have any questions, please reach out to us. And don’t forget to share the guide with your friends!