Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

261–270 of 454 posts

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

#261

Not a command-line tool but the network link conditioner is also really great. Never seen such a tool on another OS You can simulate a really bad network. Latency, bandwidth, packet loss etc. Great for testing but also if people insist on cameras being on. Just screw up the connection so bad that everyone gets annoyed with your blocky image and robot voice and suggest you turn off video and then you make it 'magicall…

Never had heard of this before. Some other cool tools in the "additional tools for X-Code" package which I had also never heard of. https://developer.apple.com/download/all/ Thanks for sharing.

I've used AU Lab to pipe my microphone input through my headphones, which is apparently how professionals like to record audio (a "monitor" so you can hear how you sound), but I couldn't get used to it

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

#262
post #38

Earlier quoted context omitted.

Also for things like sharing public ssh keys. Instead of "can you send me your public key" and getting something with random line breaks depending on the users text editor I just have to ask them to "cat ~/.ssh/id_rsa.pub | pbcopy". I also alias pbcopy / pbpaste on Linux too, so useful!

The random linebreaks are ok - SSH can handle them. (that's how Userify does it I think, too. it replicates whatever the user provides.. no judgment :)

Ah, it's more for ~/.ssh/authorized_keys which is one key per line.

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

#263
post #12
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.

On Linux I have these wrap xsel or xclip, and likewise open to xdg-open. Now, for your Mac example — if that's a specific pipeline you often use, you can write a Service menu entry to do it in place, without switching to a terminal.

+1 to the service menu actions. They are so handy, but often forgotten/overlooked. I think maybe a discoverability issue.

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

#264
I'll go for the somewhat obsolete `drutil eject` as Mac OS can be sometimes rather reluctant to eject cycle optical drives if it doesn't actually think a disc in in them. Although nowadays you'll probably be using a 3rd party tray load drive with an eject button instead of a no-button slot loading Apple one.

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

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

granted, it is a little snarky and maybe the snark isn't appropriate in today's tech environment. but no, things like "useless use of cat" do not need to go away, because they make me better at what I do in little ways. those little ways add up over time.

> but looking up the arguments and their ordering is annoying

you seem to be arguing for complacency. taking your idea to an extreme, why learn to do _anything_ well?

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

#266
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_!

I really recommend folks use "less" over cat, especially keyboard oriented folks. Different terminal emulators don't always have the scroll behavior I want, not do they always allow me to search the file I'm looking at. "less" does all those things, in nearly every environment no matter the terminal emulator, and has other wonderful options to boot (chop long lines so they don't wrap can be nice for logs, line numbers can be VITAL, etc).

I still uselessly use cat though, it's such a nice way to build a pipeline.

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

#268

The say command has one of my favorite pieces of that famous Apple polish. If you type `say os x`, it'll actually speak "oh es ten".

It says "oh es ex" for all variations I've tried

Capitalizing the phrase made it work for me

> say OS X

Edit: Late 2016 MBP on 12.6.6 Monterey

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

#269
post #146

You can use `say` to recreate your own Serial Experiments Lain intros. say -v Whisper "Weird: Layer zero one"

You may have to install extra voices somehow, looking at the manpage for say, it seems like 'say -v ?' would list the voices installed, but I don't seem to have any (like Whisper), though plain old 'say "hello world"' does do a robotic voice which must be the default.

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

#270

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

A nice feature I discovered recently is -a: you can give it a specific audio device, which falls back to the default if not present. I use it to report when builds finish through my monitor speakers in case I'm not wearing headphones. If I'm on the go and don't have the monitor connected it plays through the speakers.
Post reply on HN