Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

341–350 of 454 posts

Re: macOS command-line tools you might not know about

#342
post #287

A lot of macOS behavior can be toggled by modifying the system component defaults. For example, turn off autohiding of the Dock from commandline: defaults write com.apple.dock "autohide" -bool "false" && killall Dock Include the date in screenshots you take: defaults write com.apple.screencapture "include-date" -bool "true" Here is handy website which documents many of the defaults and their purpose: https://macos-de…

https://github.com/zcutlip/prefsniff can be handy for figuring this stuff out, you start it up, change a setting, and it reports the plist differences to you

Re: macOS command-line tools you might not know about

#344
post #102

Earlier quoted context omitted.

command shift 4 already saves a file, maybe you were thinking about command + shift + control + 3?

IIRC Cmd+shift+4 by default stores to a file, but it is easily changeable in settings. Mine has been set to store to clipboard since a long time ago (since i mostly ever take them to send to someone in chat or to insert into my own notes, for which clipboard is exactly what i need). To change it: open Screenshot app (either cmd+shift+5 or from the app launcher), click Options in the center bar, and set "Save to" to "…

You can also use shift-cmd-5 to frame the page and then cmd-c to copy the screenshot - regardless of the screenshot app settings.

Re: macOS command-line tools you might not know about

#345

`open` is one I use all the time. I love that simple command. alias tab='open . -a iterm' alias phpstorm='open -a "PhpStorm"' alias smerge='open -a "Sublime Merge"' etc. I use those more than I do the Open/Recents dialogs in the respective apps.

One flag also not mentioned is -n, which allows you to run the same application in more than one instance. Historically the single most used utility for me, though the number of applications that have had design problems bad enough to warrant it has gone down.

Re: macOS command-line tools you might not know about

#348

`open` is one I use all the time. I love that simple command. alias tab='open . -a iterm' alias phpstorm='open -a "PhpStorm"' alias smerge='open -a "Sublime Merge"' etc. I use those more than I do the Open/Recents dialogs in the respective apps.

I made a script to open files with rofi

https://github.com/davatorium/rofi

Looks like this:

https://i.imgur.com/Hm9TGeV.jpg

In a vscode terminal I just use the alias "o" and it opens that at the correct location, then I can navigate and pick a file to open in the editor.

Re: macOS command-line tools you might not know about

#349

Earlier quoted context omitted.

For me it’s one of the top benefits of the Apple ecosystem. The only drawback is that yes it only works most of the time. And when it doesn’t I get infuriated. Glitches happen without any change to settings or network on my side - it works now, and 5 min later doesn’t.

Integration is the primary reason I enjoy using Apple ecosystem. My phone, laptop, tablet and watch all work seamlessly together. I use most of Apple's "built in" applications like Mail, Notes, Photos, etc. with Firefox (instead of Safari) probably the only exception to that.

It’s wonderful when it works. For reasons beyond my comprehension, the Watch unlock for my Mac only works ~10% of the time.

Re: macOS command-line tools you might not know about

#350

Earlier quoted context omitted.

All of them do. Including bash. It’s just not the same syntax (ie ‘ But I honestly think people who try to optimise away ‘cat’ are optimising the wrong thing. If one extra fork() is that detrimental then don’t use a shell scripting language. For a lot of people, “useless” ‘cat’ enables them to write a pipeline in the order that their brain farts out the requirements for the pipeline. So they’ve optimised for human pr…

> All of them do. Including bash. Are you sure? https://unix.stackexchange.com/questions/208615/is-cat-a-she... disagrees and neither https://manpages.ubuntu.com/manpages/jammy/man7/bash-builtin... nor https://zsh.sourceforge.io/Doc/Release/Shell-Builtin-Command... mention it

Literally the next sentence after the one you quoted explains my point:

> It’s just not the same syntax (ie ‘Reading from a file isn’t a hard problem. Having a good UX for doing that is where most shells fall apart. And that’s basically what ‘cat’ offers here: an improved UX.

Having ‘cat’ as a shell builtin wouldn’t really solve the complaints raised by “useless use of” anyway because you’d still be piping (and in some cases, fork()ing too). You couldnt really use ‘cat’ as syntactic sugar for ‘https://en.m.wikipedia.org/wiki/List_of_Unix_commands#/media...) the current behaviour of shells is, in my opinion, correct. This is why my own shell has a differently named builtin that approximately serves the purpose of ‘cat’ but for instances when you need the command built into the shell and it can’t just be passing a file handle to the next command (in my case, because i wanted to pass metadata out-of-band as well as the file contents)

Post reply on HN