Need to run a terminal command as soon as possible? You can do this right from the Dock with this neat trick for Mac.
You must have the Terminal app open and running in the Mac Dock for this trick to work. The rest is super easy:
- Find the Terminal icon in the Dock on your Mac and right-click (or control-click) the Terminal Dock icon
- Select "New Command" in the pop-up menu option
##In the "New Command" window Enter the command to run in -
If you want the shell to persist after the command completes, check Run command in shell ” checkbox, otherwise by default, only the command will run, and when it completes, the shell will not be available.
I personally like to use this trick with htop, but there is no shortage of commands that work both by default and through Homebrew.
The Terminal application must be running for these Dock menu options to be available. You'll see that the new terminal window and new remote connection also have handy shortcuts.
By the way, this trick exists in both modern and older versions of Mac OS X, so if you're running on a fairly old Mac, you can use it too.
The above is the detailed content of Run new Terminal commands directly from the Dock on your Mac. For more information, please follow other related articles on the PHP Chinese website!