Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

221–230 of 454 posts

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

#221
post #190

Earlier quoted context omitted.

It creeps me out when the clipboard is unexpectedly shared between my phone and computer. And since the feature seems to turn on randomly but not reliably when I want it to, I’d rather it just didn’t exist.

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.

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

#222

Earlier quoted context omitted.

If I had a nickel for each `cat foo.json | jq | pbcopy`, I'd be a rich man :)

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

Is there any shell that has cat as a built-in?

Such a shell could remove some of the more common cases.

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

#223
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!

Userify would have made that pretty painless (all it really seems to do is update the authorized_keys across all of your servers every minute or so)

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

#225

Years ago, I wrote a script to find something in a big blob of data and to alert me when it was done, I added a “say ” type phrase upon completion. I forgot about it and went to bed and was jolted awake hours later by what was clearly an “intruder” speaking to his accomplice, in my home office. Quite the relief when I realized what happened.

I use Pushover for a few alerts so years ago I wrote a little bash script called `push` that you pass a title and optionally a body. Was very nice to to `./longRunningCommand && push "Task Done" "Here is a body"`. I'd sometimes combine this with my `beep` script that just makes a noise for when I know I'll still be at my computer but want to know when something finishes.

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

#226
post #189

Earlier quoted context omitted.

Yes, this iterative procedure is often why "useless" cats get put into it. It's a very effective way of processing regular text information. e.g. I need to grab some info from textfile.txt to use as arguments to a function. cat textfile.txt looks like its comma delimited. cat textfile.txt | cut -d, -f 2-5 ah, its the third and fourth column i need cat textfile.txt | cut -d, -f 3-4 | grep '123456' perfect cat textfile…

> cat textfile.txt > looks like its comma delimited. Interesting; why wouldn't you use `head`? Who knows how big textfile.txt is?

generally, speaking, if you don't have an idea of how big the file is, or it would take up too much real-estate on your terminal window, sure. 100%. It was just an example.

lot's of times we sort of know what we are working with, but don't remember the particulars especially

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

#227

wait caffeinate exists natively? ive been using a third party caffeine tool for the longest time..

For a long time I used an app for this as well, but the app was just a thin wrapper around the CLI tool

after seeing the post i realized this is probably the case for most of us

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

#228
post #190
post #172

Earlier quoted context omitted.

It's cool to use pbcopy and pbpaste with your phone! Copy some text on the phone, and you can pbpaste it onto the Mac command line. So cool.

It creeps me out when the clipboard is unexpectedly shared between my phone and computer. And since the feature seems to turn on randomly but not reliably when I want it to, I’d rather it just didn’t exist.

> is unexpectedly shared between my phone and computer

There was a prompt asking if I wanted to enable it, when I set up my phone/Mac. Same setup screen that asks if you want to enable location, Siri, etc.

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

#229

Self-plug of displayplacer[0] for changing screen resolutions/rotations/etc via the command line. [0] https://github.com/jakehilborn/displayplacer

This tool is invaluable, I love it so much. I have 2 workspaces and I love just running the command (via Alfred) when I plug into my dock at either place that fixes all my monitors. I could script it so that as soon as my computer recognizes a monitor UUID it fires off the correct displayplacer command but I don't switch often enough to care (the 2 desks are 3.5+ hours apart).

When I was commuting daily displayplacer was even more indispensable but even for just unplugging my mac and using the internal screen vs my monitors I get a ton of value out of this tool.

Post reply on HN