Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

191–200 of 454 posts

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

#191

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`.

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

#192
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.

Disabling Handoff is currently the only way to disable Universal Clipboard.

* Mac: Go to System Preferences > General > uncheck Allow Handoff.

* iPhone: Go to Settings > General > Handoff > uncheck Handoff.

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

#193

I use: ``` #!/usr/bin/env bash set -u title=${2:-Shell} msg=$1 osascript -e "display notification \"$1\" with title \"$title\"" ``` As `~/bin/,notify` and put it at the end of long-running commands: ``` run_this_program && ,notify "Long program is done!" ```

I can’t help but ask, why “,notify” and not just “notify”?

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

#194
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.

This. "Useless cat" is more useful than "useless file-arg".

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

#195
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.

Make sure both your phone and computer have Wi-Fi and Bluetooth turned on.

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

#196
post #98

Earlier quoted context omitted.

In what way do you see those alternatives as superior?

They avoid an unnecessary invocation of the cat executable. Instead, they open a file descriptor and pass that. Tiny difference but there you go.

>They avoid an unnecessary invocation of the cat executable.

And ... ?

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

#199
> open - open files and applications

And urls! I use that one in a lot of my scripts. We have a ticket-based workflow, and I can parse out the ticket number from the current git branch, and open the ticket or create a merge requests without having to do anything complicated.

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

#200

I use: ``` #!/usr/bin/env bash set -u title=${2:-Shell} msg=$1 osascript -e "display notification \"$1\" with title \"$title\"" ``` As `~/bin/,notify` and put it at the end of long-running commands: ``` run_this_program && ,notify "Long program is done!" ```

I can’t help but ask, why “,notify” and not just “notify”?

I name all my personal programs prefixed by the comma. I learnt it from someone on lobste.rs. No Unix utilities use the prefix in their name and it is a valid filename.

So I can type , and I am sure it's my program and I'm not running something else and it'll autocomplete among my list of programs.

Post reply on HN