Skip to content

Instantly share code, notes, and snippets.

@LoopsGod
Last active July 25, 2023 15:09
Show Gist options
  • Save LoopsGod/9587ab86217901a920e9f4d5d4bf3c89 to your computer and use it in GitHub Desktop.
Save LoopsGod/9587ab86217901a920e9f4d5d4bf3c89 to your computer and use it in GitHub Desktop.
Open Finder in current location (MacOS)
#
# This gist shows how to open your finder in your current terminal
# directory.
#
open -a finder $(pwd)

Creating Terminal shortcut

This gist shows how to set up the 'open finder here' shortcut (opf) in a bash or zsh shell. This tutorial is for MacOS, since MacOS uses Finder.

Zsh

Open the .zshrc configuration file.

nano ~/.zshrc

Add the following line:

alias opf='open -a finder $(pwd)'

Optionally, substitute the opf part with your own shortcut command.

Save and exit. Make sure to type exit in your current terminal to re-apply the terminal configuration.

Bash

Open the .bashrc configuration file.

nano ~/.bashrc

Add the following line:

alias opf='open -a finder $(pwd)'

Optionally, substitute the opf part with your own shortcut command.

Save and exit. Make sure to type exit in your current terminal to re-apply the terminal configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment