{"id":2037,"date":"2026-01-11T13:21:38","date_gmt":"2026-01-11T13:21:38","guid":{"rendered":"http:\/\/valentinedaysgifts.com\/index.php\/2026\/01\/11\/most-useful-terminal-commands-for-macos-2026\/"},"modified":"2026-01-11T13:21:38","modified_gmt":"2026-01-11T13:21:38","slug":"most-useful-terminal-commands-for-macos-2026","status":"publish","type":"post","link":"http:\/\/valentinedaysgifts.com\/index.php\/2026\/01\/11\/most-useful-terminal-commands-for-macos-2026\/","title":{"rendered":"Most useful Terminal commands for macOS (2026)"},"content":{"rendered":"
Terminal is one of the most powerful macOS apps, allowing you to perform actions with different commands. Although Terminal commands may seem intimidating to carry out, they aren\u2019t! Once you know them, you can quickly perform tasks like shutting down your Mac or copying contents from one place to another in a few clicks.<\/p>\n
Terminal is a CLI (Command Line Interface), the language we type which interacts with the Mac. This tool is often overlooked as it is different from the GUI (Graphical User Interface), offering a rich interface. However, I\u2019ve a useful list of macOS Terminal Commands that you can learn easily and do things instantly. Let\u2019s start with the basics!<\/p>\n
Spotlight is undoubtedly the easiest way to open Terminal on Mac. Follow the steps below to open Terminal.<\/p>\n
Now, let’s see how to get most of Terminal!<\/p>\n
It is annoying when your Mac goes to sleep when you are off for a short break. Of course, you can change Sleep Settings in System Preferences. However, it is easier to use Terminal to keep your Mac awake with the following command.<\/p>\n
caffeinate<\/strong><\/span><\/p>\n That’s not all! You can also add a timer to the command. Doing so will disable “caffeinate” mode after a preset time. You need to put the -t flag and specify the time in seconds, as shown below.<\/p>\n caffeinate -t 150000<\/span><\/p>\n In this case, your Mac will exit the mode after 15,000 seconds or 250 minutes. You can increase or decrease the timer by changing the number of seconds in the command.<\/p>\n I have seldom faced issues with Mac’s DNS cache. Yet I would suggest you flush DNS cache on Mac every once in a while. Not doing so will lead to problems like loading websites and 404 errors. (add screenshot- macos-shell-flush-dns)<\/p>\n Enter the following command to flush DNS on Mac.<\/p>\n Note<\/em><\/strong>: This command works only on macOS El Capitan and above. After flushing DNS, check if you can access the website with the issue.<\/p>\n Too many apps in Dock triggering your OCD? Well, you can increase the spacing between each apps using terminal commands. Once done, your Dock will look neat and tidy.<\/p>\n And hit Return<\/strong>.<\/p>\n Once done, type: Mac saves screenshot with date and time as default. The naming convention tends to look unprofessional. Worry not; once again macOS terminal comes to the rescue. You can change the default name for a screenshot using the below command.<\/p>\n Now type:<\/p>\n Now that you have fixed the screenshot naming, how about changing the format? macOS saves a screenshot in the PNG format. Some online portals like immigration require images to be in .jpg format.<\/p>\n Spending time to convert saved images to other formats is not ideal. Instead, you can use the terminal code to change the default image format. Furthermore, you can choose between Jpeg, TIFF, GIF, or even RAW (ideal for post-processing photos.)<\/p>\n Want to download a file directly? With Terminal, you can download a file directly from the Internet. This method is useful only if you have a direct download link. Type the following command.<\/p>\n Note<\/em>:<\/strong> If you want to download the contents to any other directory, replace “downloads” with the directory name.<\/p>\n I recommend password-protecting sensitive data before sharing it with anyone. You can share the password separately with recipients. Using Terminal, you can compress and password-protect the folder<\/a>. You need to navigate to Desktop and select the folder using the below command.<\/p>\n Select the folder<\/p>\n Swap Output folder name.zip<\/strong> with the desired name. Specify the origin in the source folder name.<\/strong> In other words, you need to mention the origin and target file names. Interestingly you can also change the extension of the output file. Simply add an extension (e.g., .pdf) at the end of the above command.<\/p>\n macOS hides critical files. The fail-safe mechanism assures that you don’t delete a system file by mistake. Doing so could crash your Mac. However, the feature becomes a limitation whenever you want to view hidden files on an external drive. <\/p>\n The solution for this is the below Terminal command that lets you view hidden files.<\/p>\n Now you will get to see all the hidden files. <\/p>\n Enter<\/strong><\/p>\n A word of caution<\/strong>: Don’t delete important system files. Before deleting anything, run a Google search. Use “False” instead of “True” in the above command to hide files again.<\/p>\n To access the data from your iCloud Drive, use the following command.<\/p>\n However, we already have a detailed guide on how you can access, copy, or move data to your iCloud Drive<\/a>, which you can check out anytime.<\/p>\n To shut down your mac with CLI (Command Line Interface) aka Terminal, use.<\/p>\n Just as shut down, you can restart your Mac by<\/p>\n Whenever you\u2019re updating the Mac to the new version, backups are essential. The easiest way to take a backup is to use Time Machine. But do you know? You can speed up time machine backup using the terminal by this command.<\/p>\n Copying contents from one place to another is fairly easy with Terminal. Type in the following command:<\/p>\n Replace original<\/strong> with the current directory and new<\/strong> with the name of the directory to which you want to copy the contents.<\/p>\n This is the coolest command that macOS provides. You can make your Mac say anything you want by using the say command<\/strong> followed by the words.<\/p>\n If your desktop has become a dumping ground for files, you can hide all desktop icons without deleting anything. Here’s how<\/p>\n Enter the following command and hit Return:<\/p>\n This removes all desktop icons from view.<\/p>\n To bring them back later:<\/p>\n Instead of searching through Finder or Spotlight, you can use Terminal to open apps, files, or websites instantly.<\/p>\n This Terminal command displays battery information beyond what System Settings shows:<\/p>\n This displays battery health, cycle count, and power usage details.<\/p>\n macOS includes a built-in network testing tool that lets you quickly check your internet performance without relying on third-party websites or apps, making it useful for quick diagnostics and troubleshooting.<\/p>\n This runs a basic internet speed test. If you want results, try this command instead:<\/p>\n You can also save the output to a file for reference or sharing.<\/p>\n If you prefer a minimal Dock that only shows apps currently in use.<\/p>\n This hides inactive apps from the Dock.<\/p>\n To restore the default Dock behavior:<\/p>\n With iOS 26, Apple finally supports setting custom ringtones on iPhone. On older iOS versions, you still need third-party workarounds. Using a few simple macOS Terminal commands, you can streamline the entire process. Here is how.<\/p>\n First, convert the audio file into AAC format, which iOS requires for ringtones.<\/p>\n Next, rename the file extension from .m4a to .m4r, the ringtone format recognized by iOS 26.<\/p>\n After this, sync the .m4r file to your iPhone using Finder, and it will appear under custom ringtones in iOS 26.<\/p>\n You do not need to be a power user to benefit from macOS Terminal. Even a small set of practical commands can help you work faster, troubleshoot issues, and customize your Mac more effectively. With the right use cases, Terminal quickly becomes one of the most useful tools built into macOS.<\/p>\n If you find these Terminal commands useful, bookmark this post for future reference. It is the kind of guide that comes in handy when you need a quick fix or shortcut without having to dig through menus.<\/p>\n Related Reads:<\/strong><\/p>\n The post Most useful Terminal commands for macOS (2026)<\/a> appeared first on iGeeksBlog<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" Master your Mac. Learn the best macOS Terminal commands to change hidden settings, fix issues, and speed up your workflow.
<\/figure>\n2. Flush DNS Cache<\/h2>\n
udo dscacheutil -flushcache; sudo killall -HUP mDNSResponder<\/em><\/code><\/p>\n
<\/figure>\n3. Increase Spacing Between Dock Apps<\/h2>\n
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type=\"spacer-tile\";}'<\/code><\/p>\nkillall Dock<\/code> and press Return<\/strong> again.<\/p>\n
<\/figure>\n4. Change Default Screenshot Name<\/h2>\n
defaults write com.apple.screencapture name \"New Screen Shot Name\"<\/code><\/p>\nkillall SystemUIServer<\/em><\/code><\/p>\n
<\/figure>\n5. Change Default Screenshot Format<\/h2>\n
defaults write com.apple.screencapture type jpg<\/span><\/code><\/p>\n
<\/figure>\n5. Download Files Without a Browser<\/h2>\n
cd ~\/Downloads\/<\/code><\/p>\ncurl -O [URL of file you want to download]<\/code><\/p>\n6. Compress and Password-Protect Folders<\/h2>\n
cd ~\/Desktop\/<\/code><\/p>\nzip -er <output folder name.zip> <source folder name><\/code><\/p>\n7. Display Hidden Files and Folders<\/h2>\n
defaults write com.apple.finder AppleShowAllFiles -bool TRUE<\/span><\/code><\/p>\nkillall Finder<\/code><\/p>\n8. Access iCloud Drive Using Terminal<\/h2>\n
cd ~\/Library\/Mobile Documents\/com~apple~CloudDocs\/<\/code><\/p>\n9. Shut Down or Restart Mac Using Terminal.<\/h2>\n
sudo shutdown -h now<\/code><\/p>\nsudo shutdown -r now<\/code><\/p>\n10. Supercharge Time Machine Backup<\/h2>\n
sudo sysctl debug.lowpri_throttle_enabled=1<\/code><\/p>\n11. Copy Contents from One Folder to Another<\/h2>\n
ditto -V ~\/original\/folder\/ ~\/new\/folder\/<\/code><\/p>\n12. Make Your Mac Say Anything You Want<\/h2>\n
SAY \u201cHELLO, IGEEKSBLOG\u201d<\/code><\/p>\n13. Declutter Your Desktop Instantly<\/h2>\n
defaults write com.apple.finder CreateDesktop -bool false && killall Finder<\/code><\/p>\ndefaults write com.apple.finder CreateDesktop -bool true && killall Finder<\/code><\/p>\n14. Quickly Open Apps, Files, or Websites<\/h2>\n
open -a \"Safari\"
<\/code><\/p>\nopen MyFile.pdf<\/code><\/p>\nopen https:\/\/igeeksblog.com<\/code><\/p>\n15. Check Battery Health from Terminal<\/h2>\n
system_profiler SPPowerDataType<\/code><\/p>\n16. Test Your Internet Connection from Terminal<\/h2>\n
networkQuality<\/code><\/p>\nnetworkQuality -v<\/code><\/p>\nnetworkQuality -v > ~\/Desktop\/speedtest.txt<\/code><\/p>\n17. Customize the Dock to Show Only Active Apps<\/h2>\n
defaults write com.apple.dock static-only -bool true && killall Dock<\/code><\/p>\ndefaults write com.apple.dock static-only -bool false && killall Dock<\/code><\/p>\n18. Convert Files Into Custom Ringtones<\/h2>\n
afconvert input.mp3 output.m4a -f m4af<\/code><\/p>\nmv output.m4a output.m4r<\/code><\/p>\nSigning Off..<\/h2>\n
\n
\nThe post Most useful Terminal commands for macOS (2026) appeared first on iGe<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-2037","post","type-post","status-publish","format-standard","hentry","category-mac"],"_links":{"self":[{"href":"http:\/\/valentinedaysgifts.com\/index.php\/wp-json\/wp\/v2\/posts\/2037","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/valentinedaysgifts.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/valentinedaysgifts.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"http:\/\/valentinedaysgifts.com\/index.php\/wp-json\/wp\/v2\/comments?post=2037"}],"version-history":[{"count":0,"href":"http:\/\/valentinedaysgifts.com\/index.php\/wp-json\/wp\/v2\/posts\/2037\/revisions"}],"wp:attachment":[{"href":"http:\/\/valentinedaysgifts.com\/index.php\/wp-json\/wp\/v2\/media?parent=2037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/valentinedaysgifts.com\/index.php\/wp-json\/wp\/v2\/categories?post=2037"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/valentinedaysgifts.com\/index.php\/wp-json\/wp\/v2\/tags?post=2037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}