Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

251–260 of 454 posts

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

#251
post #213
post #189

Earlier quoted context omitted.

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

Don't forget to pipe head into 'cat -v'... that text file could contain _anything_!

Thank you for pointing this out! This is much safer.

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

#253

I just freaked out my cat using `say`. I'm going to enjoy this too much.

try it out with different voices, for starters try say "process failure" -v trinoids you can find all the available voices with say -v '?' or from Accessibility>Spoken-Content>System-voice>Manage-voices

I liked the option of using `-v organ`

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

#255
post #8

`pbcopy` and `pbpaste` are one of my most-loved in the list. Dealing with some minified json, switching to iTerm, doing `pbpaste | json_pp | pbcopy` and having a clean output is _so_ nice.

pb[paste|copy] are a life improver. Here is a one-liner to edit the pasteboard contents in vim.

  pbpaste > tmp; vim tmp; cat tmp | pbcopy; rm tmp;
I also use pbpaste to append various notes to files, but since pbpaste doesnt have a newline at the end I wind up using:

  echo "$(pbpaste)" >> notes.txt

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

#256

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

https://porkmail.org/era/unix/award

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

#257
post #255
post #8

`pbcopy` and `pbpaste` are one of my most-loved in the list. Dealing with some minified json, switching to iTerm, doing `pbpaste | json_pp | pbcopy` and having a clean output is _so_ nice.

pb[paste|copy] are a life improver. Here is a one-liner to edit the pasteboard contents in vim. pbpaste > tmp; vim tmp; cat tmp | pbcopy; rm tmp; I also use pbpaste to append various notes to files, but since pbpaste doesnt have a newline at the end I wind up using: echo "$(pbpaste)" >> notes.txt

You can do this specific task with just vim: https://vi.stackexchange.com/a/21448

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

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

I have a clipboard manager application called "Paste" (creative i know). Its an awesome app for a million reasons. But one thing I like is that it allows me to see and hear when my iphone copy worked. So I have it enabled so there is a sound when something goes into the clipboard. Even on my mac, I have come to rely on that audio feedback. But it has the added benefit that when I am using my phone in front of my comp…

I wonder if it's this one: https://apps.apple.com/us/app/paste-clipboard-manager/id9678...

I've noticed that more and more apps on both macOS and iOS sniff the clipboard contents and randomly clobber it. I usually notice it in apps like Sourcetree, where I'll click something or do a certain action and suddenly I can't paste anymore. I even get a feel for it, like my mind detects the pattern that empties the clipboard so I sense when I can no longer paste, but I can't figure out concrete repeatable steps to make it happen. On iOS it's more random, and I feel like it's probably Facebook doing it, or maybe websites in Safari. I just assume that everything is spying on my clipboard contents now, hoping to log secrets/passwords and PII to sell to scammers.

I have to say, this is one of the more disappointing developments from Apple, that they certainly must know by now about these clipboard shenanigans, but have done nothing to stop them. They need to implement permissions that deny all apps the ability to get/set the clipboard by default, and have an option to ask the user whether so-and-so app can access the clipboard (outside of normal copy/paste), every time with the option to allow always. And all clipboard access attempts should probably get logged somewhere.

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

#260
post #139

Not a bad list of basic macOS specific cli tools. For a more in depth list, I usually reference https://ss64.com/osx/ .

A tad outdated. At a glance I see it’s missing `networkQuality` (introduced in Monterey) and `realpath` (added in Ventura).

Agreed. Some of the flags are missing as well. Not sure it's updated often, but still not a bad starting point. If only Apple would publish something directly. They do a pretty good job with the Apple Platform Deployment guide (https://support.apple.com/guide/deployment). And the Security guide (https://support.apple.com/guide/security).
Post reply on HN