Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

271–280 of 454 posts

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

#271
post #120
post #83

Earlier quoted context omitted.

I like to use `pbcopy` when exporting public keys to external services like GitHub. `cat ~/.ssh/mykey.pub | pbcopy`

I love this tool too! except one time I quickly typed `cat ~/.ssh/mykey | pbcopy` And sent it straight away to my coworker on Slack. I then spent the rest of the day making a new private key and adding my new pubkey to all of the 1000+ servers I had root access to. I mean we had tools to help but it still wasn’t fun. With great power/convenience comes the potential to do dumb things at lightning speeds!

If you literally have ssh root access to 1000+ servers, using certificates will be more secure and convenient than directly using public key.

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

#272
post #5

I was aware of about half of these but textutil, networkUtility, and sips I didn’t not and look really interesting

We heavily used `sips` when I was at Apple, because it was quicker than writing code against QuickTime or the other rendering subsystems.

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

#273

Earlier quoted context omitted.

That's a useless use of cat. You can use `jq . foo.json | pbcopy` or `jq < foo.json | pbcopy`.

Speaking for myself, the first form is more natural- even if it’s a useless cat, because I’m always cat-ing files to see their structure. Then progressively tacking on different transforms. And then finally putting it in whatever I want as output. It’s so ingrained, I’m more likely than not to just write it out that way even when I know exactly what I’m doing from the onset.

If you're using zsh, you can just replace any instance of

    $ cat somefile ...
with

    $ 
For bash, this only works if you have at least one `|`.

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

#275
post #191

Earlier quoted context omitted.

That's a useless use of cat. You can use `jq . foo.json | pbcopy` or `jq < foo.json | pbcopy`.

The “useless cat” meme needs to die. Everyone is aware that most commands accept a file argument, but looking up the arguments and their ordering is annoying and using cat for things like this is just fine.

Everyone is not aware, new people are joining all the time.

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

#276

Earlier quoted context omitted.

additional bonus, you can input an SVG at the start if you use qlmanage first instead of the cp command: qlmanage -t -s 1024x1024 -o MyIcon.iconset/Icon1024.png icon.svg

Note of caution: if qlmanage uses QuickLook SVG rendering, YMMV. I recently had to deal with SVGs that render broken in Finder but correctly in, say, Affinity or Adobe tools. Rasterization feels sufficiently finicky that I personally would consider it part of designer’s workflow rather than automated conversion pipeline; but then some would say the same about raster versions at different sizes, so in the end it depen…

That’s fair. I will say, I’ve found that svgs that only rendered “right” in Adobe/Affinity to be broken most other places too.

May be a version thing, may be some extended stuff that more common parsers do not support, not sure.

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

#277

`pbcopy | jq | pbpaste` is a very frequent command that I run to quickly format json in the clipboard. I use pbcopy and pbpaste probably all day long and always miss it in Linux environments.

Slick! I need to figure out how to get something like this for SQL

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

#278
Some that were missed:

diskutil: modify, verify and repair local disk

hdiutil: manipulate disk images (attach, verify, create, etc)

dscl: Directory Service command line utility (manage users and groups)

scutil: Manage system configuration parameters (useful for checking current DNS configuration and checking reachability to a host).

sysadminctl: It's a secret! No man page. Run without options to get a usage message, but even the usage is apparently incomplete. It's a grab-bag of functionality. I use for adding/removing a temporary build user as part of a CI/CD setup.

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

#279
post #254

Earlier quoted context omitted.

Maccy ( https://maccy.app/ ) is a clipboard manager for Mac and by Clicking ALT+M , it shows all the recent copied texts in a popup.

Is that Option-M?

I use external logitech keyboard, where it's Alt+M but yes, it's actually Command+M on Macbook

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

#280
post #120
post #83

Earlier quoted context omitted.

I like to use `pbcopy` when exporting public keys to external services like GitHub. `cat ~/.ssh/mykey.pub | pbcopy`

I love this tool too! except one time I quickly typed `cat ~/.ssh/mykey | pbcopy` And sent it straight away to my coworker on Slack. I then spent the rest of the day making a new private key and adding my new pubkey to all of the 1000+ servers I had root access to. I mean we had tools to help but it still wasn’t fun. With great power/convenience comes the potential to do dumb things at lightning speeds!

put your private key in something like Secretive: https://github.com/maxgoedjen/secretive
Post reply on HN