4 ms·
Few additions. open -n file.pdf : opens new instance of Preview application which is useful if you want to open the same file twice (for example to look at dif
by vbezhenar 2y ago
Few additions.
open -n file.pdf : opens new instance of Preview application which is useful if you want to open the same file twice (for example to look at different pages at once).
caffeinate -d : prevents display turning off, useful if you want to look at display without moving mouse.
- wwader 2y agoopen -a is nice, i use it with alias, ex: alias qt='open -a "quicktime player"' alias vlc='open -a "vlc"'
- mjs 2y agoDoes `open` give focus? It used to, but since a few releases ago the app opens in the background, which is pretty annoying. My poor workaround is to use osascript: `tell application "System Events" to set frontmost of process "Finder" to true`
- masswerk 2y agoApparently, it does. There is a -g flag (background) to prevent focus.
- justletmein 2y agoIsn’t open opening apps in the background a consequence of having “secure keyboard entry” enabled in Terminal.app?
- troupo 2y ago`caffeinate -disu` is the best combination (that is, enable all options): your laptop won't go to sleep, won't dim the screem etc.
- 1ncorrect 2y agoI use this all the time: open -a <GUI Application> <File> Handy for distinguishing between editing and consuming media.
- alsetmusic 2y agoAlso, `cd .` to open the current directory in a Finder window. Not mine (found online years ago), but here's the opposite. `cd` into the frontmost Finder window: cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')";
- kps 2y agoYou mean `open .`
- alsetmusic 2y agoYeah, I had just woke up. Drat.
- sneak 2y agoYou can also just drag the proxy icon onto the terminal window for its path, ie “cd “ <drop>, enter.
- kstrauser 2y agoI use that all the time. You can also cmd-c copy a file in Finder then paste into the terminal to get its path.
- alsetmusic 2y agoI genuinely didn't know this. I would have thought I had to do the "copy as pathname" trick with a right-click while holding Option. I already knew the drag and drop feature, so this doesn't really save me time, but it's good to know another nice feature.
- hk1337 2y agoopen -a "Finder" . - open Finder in the current directory. Standard apps usually just need the name, like Finder and Safari but you can also specify the path "/Applications/DifferentFinder.app"
- ssttoo 2y ago`open .` works for me too
- hk1337 2y agoYeah, I scrolled a bit and noticed that. Never thought about using just that.
- 1-more 2y agoAlso `open -R path/to/file` opens Finder in the containing directory with the file highlighted (and thus scrolled into view). I use this with a script that takes a screen recording and trims some specified seconds off the end and converts it to mp4 to be smaller when I upload into a Github PR description. Easiest to drag and drop the converted file, y'see.
- nextos 2y agoFinder is pretty good, and it's handy to be able to open it from the terminal. But I find it super annoying it litters everything with .DS_Store files and there is no way to turn that off, except for external and network drives. Aside from, obviously, using a different file manager. Very un-Apple.
- nutrie 2y agoActually, .DS_Store is very Apple indeed (not that I care much).
- dwaite 2y agoThe .DS_Store files are not Finder specific; Apple treats everything as a file (including folders), and it exists to supply folders and the files within them with metadata. It is just the first time the .DS_Store file is needed is often when the folder is touched by Finder.
- impalallama 2y agocaffeinate -d is incredibly useful for work... uh reasons
- JasserInicide 2y agoJiggler is better for that at least from a set-it-and-forget-it perspective vs. caffeinate where you have to manually set it.
- seec 2y agoThat's one of macOS pitfalls: the inability to open 2 instances of the same app, simply using the default GUI is annoying sometimes. I think Windows is right in that matter...
- beancookies 2y agoAnother useful caffeinate tip is the `-w` option. You can use it to pass a pid to keep the computer awake until that process completes. I use it for longer-running scripts that I don't want interrupted
- justinsaccount 2y agoThat's mostly what `caffeinate your-script` is for.