I know how to open it in Finder:
open .
But, how can I open it in ForkLift?
A little bit late to the party, anyway it's worth of better description, so here you are. Keep in mind that this answer is based on the RED's one-liner, just with some (little bit mooo...oore details ;) )
Use the following command to open the current folder (in this case, the dot represents the pwd
command):
open -a ForkLift .
#or the same
open -a ForkLift `pwd`
or any other existing folder using absolute or relative path, i.e.:
# Absolute path to Apache's logs
open -a ForkLift /var/log/apache2/
# Relative path from home folder to `All Them Witches` within `Music` folder.
open -a ForkLift ~/Music/All\ Them\ Witches
# Relative from current position, ie while you're already in `~/Music` folder
open -a ForkLift All\ Them\ Witches
#or
open -a ForkLift "All Them Witches"
open
command does?Check yourself in terminal with man open
;) It just opens a file or directory with default application for file type. So as you already know open .
opens the current folder in the Finder, but for an instance open foo.txt
will (try to) open the file in the default text editor, open foo.psd
in Adobe Photoshop, generic graphic files, like open foo.jpg
or open foo.png
in the Macos Preview, etc.
-a
parameter for open
commandIndicates which application we want to force instead of default one, the pseudo-schema would look like:
open <with-my-preferd-app> <file or directory>
so pseudo-explain of the RED's open -a ForkLift .
is exactly
open <with ForkLift app in /Applications folder> <current directory>
Finally, you can use it as reference to application within Aplication
folder (no need to add *.app
ext then) like:
open -a Sublime\ Text foo\ file.txt
#or (other handling of spaces in app and/or file name(s))
open -a "Sublime Text" "foo file.txt"
#or (by specyfing its full, absolute path)
open -a /Applications/Sublime\ Text.app ~/Documents/foo\ file.txt
or to another app (i.e. your custom editor you wrote) in other folder than /Applications
like:
open -a /full/path/to/YourOwnEditor.app bar.txt
Back to the ForkLift
, of course, you can add an alias to your ~/.zshrc
or ~/.bashrc
(depending on used shell) to replace open -a Forklift
with simple forklift
(or any other alias you want), like this (trailing space placed intentionally (please see below section Clarification about trailing space in alias(es)
!):
alias forklift='open -a Forklift '
to open folders in FL with:
# current dir
forklift .
# or the same
forklift `pwd`
#or folder relative to your home
foklift ~/Music/All\ Them\ Witches
#or absolute path
foklift /Users/whitesiroi/Music/All\ Them\ Witches
etc, etc...
Finally following this you can add several other aliases, to open files in different editors/apps (if they are installed in your system ofc),
# Console in older Macos
alias console='open -a "/Applications/Utilities/Console.app" '
# Console in newer Macos
alias console='open -a "/System/Applications/Utilities/Console.app" '
# Sublime Text (if installed)
alias subl='open -a "Sublime Text" '
# GitHub Atom (if installed)
alias atom='open -a Atom '
# etc...
Don't forget to re-load your profile file after adding/modyfing/removing aliases, depending on which shell you're workin', source
your profile file i.e.:
# . at the beginning is a system alias for `source` command here
. ~/.zshrc
# so you can use it also like
source ~/.zshrc
# or the same for ~/.bashrc
then just run alias
command without parameters, to check if your changes are taken into account.
Optionally, instead of sourcing, you can just reset your session (close and re-open, here it comes comfortable to configure in iTerm Profile(s) for most common sessions you work every day) or create a new one.
Note, that trailing space in aliases is not mandatory, also sometimes may not work as expected, everything depends on what does your alias do. Read more about its reason and usage in another cool answer, then create the one which fits your needs correctly: https://unix.stackexchange.com/a/25329/141140
Quite safe approach is creating two aliases and test each in different scenarios, i.e.:
forklift
- without trailing spaceforklift-expanded
with trailing spaceEOF
Use following command:
open -a ForkLift .