The Mac Terminal is a powerful tool that many users find intimidating to use. Combining Terminal with the standard macOS graphical interface is one way that you can make the command line app a little more user-friendly.
Drag and Drop Files and Folders
Terminal requires that you type commands in order to perform actions, but these commands need to be typed perfectly to execute. One of the easiest mistakes to make when typing a command is to get the location of a file or folder wrong.
This is especially true when folders have spaces in their names since you need to “escape” the space. For example,
~/Documents/My Stuff must be typed as
~Documents/My\ Stuff/ instead.
Instead of typing the location, you can drag and drop it. When you do this, you’ll insert the exact file location into your current command, wherever the cursor is.
You can use this for individual files by dragging and dropping them into the Terminal window. You can also do it for folders, including icons in the title bar of a folder window (Click and drag the small folder icon that appears next to the folder name.).
As an alternative to drag and drop, you can copy the file or folder in Finder and then use the paste shortcut (Command+V) in Terminal to insert the location instead.
Some Example Uses for This Tip
This is useful for inserting precise file names and long pathnames into commands. For example, if you download a Linux ISO file that you need to convert into a DMG file using the
hdiutil convert command, you can drag the ISO from your Downloads stack in the macOS dock directly into Terminal.
It’s also possible to use drag and drop functionality as you would other apps that are pinned to the dock. For example, if you drag and drop a folder onto the Terminal icon, you’ll
cd (change directory) to that folder immediately.
Do More with the Mac Terminal
A basic understanding of some macOS Terminal commands can go a long way. There’s ample built-in help documentation at a system level, and tips like drag and drop can dramatically speed up some processes.
If you’ve never touched the macOS Terminal before, then you owe it to yourself to check out the Linux-inspired Homebrew package manager.
- › How to Fix “App Is Damaged and Can’t Be Opened” on Mac
- › How to Add or Remove a Secondary Axis in an Excel Chart
- › Microsoft Now Sells Tiny Hoodies for Cold Xbox Controllers
- › How to Add Travel Time to a Google Calendar Event
- › You Can Now Get Proton Calendar on Your iPhone
- › Google Chrome Has a New Search Sidebar: Here’s How to Use It
- › What is File Versioning, and Do You Need It?