2

How can I open a terminal that is located in the current finder directory with a keyboard shortcut?

I am aware of all the answers out there, particularly from this thread How can I open a Terminal window directly from my current Finder location? that all fulfill only one or two of the criterias mentioned above.

The Keyboard shortcut options in the system configuration also require you to select some folder to open it in the Terminal, but I need the one that is opened in the very moment.

High Sierra 10.13.4

1 Answer 1

2

This is a little old, but I thought I could leave this for anyone who's interested. I created a quick action with the following AppleScript:

try
    tell application "Finder" to set the this_folder ¬
        to (folder of the front window) as alias
on error -- no open folder windows
    set the this_folder to path to desktop folder as alias
end try

set thefullpath to POSIX path of this_folder

tell application "Terminal"
    do script "cd \"" & thefullpath & "\""
end tell

Choose no input for Workflow receives current and Finder for Application. Save the quick action.

In System Preferences, go to Keyboard » Keyboard Shortcuts » Services, find the service action just created (should be under General), and assign your keyboard shortcut to it.

This basically reads the full path of the current folder and run cd in the terminal. It's not very elegant but at least it does the function.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .