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!
macOS command-line tools you might not know about
271–280 of 454 posts
Re: macOS command-line tools you might not know about
#272I was aware of about half of these but textutil, networkUtility, and sips I didn’t not and look really interesting
Re: macOS command-line tools you might not know about
#273Earlier 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.
$ cat somefile ...
with $
For bash, this only works if you have at least one `|`.Re: macOS command-line tools you might not know about
#274Someone should turn this HN discussion into a gist.
Re: macOS command-line tools you might not know about
#275Earlier 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.
Re: macOS command-line tools you might not know about
#276Earlier 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…
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.
Re: macOS command-line tools you might not know about
#278diskutil: 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
#279Re: macOS command-line tools you might not know about
#280Earlier 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!