Live data from Hacker News

macOS command-line tools you might not know about

saurabhs.org

101–110 of 454 posts

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

#101
post #97
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.

Those are so useful that I wrote trivial shell functions that do the same under Linux.

Since I'm bouncing between OSX and Linux a lot, I have a shell script with the same name on each that boils down to:

  if [ `uname` == "Darwin" ]; then
    pbcopy
  else
    xsel --clipboard
  fi

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

#102
post #90

Surprised pngpaste isn't mentioned (in the article nor the comments). If you take a screen shot (command + shift + 4) or partial screen shot (command + shift + control + 4) you can save it directly to an image file with: pngpaste filename.png

command shift 4 already saves a file, maybe you were thinking about command + shift + control + 3?

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

#103
post #99
post #90

Surprised pngpaste isn't mentioned (in the article nor the comments). If you take a screen shot (command + shift + 4) or partial screen shot (command + shift + control + 4) you can save it directly to an image file with: pngpaste filename.png

Both commands you listed take a partial screenshot. The first one saves it to the desktop and the second one (with control) to the clipboard.

Oops, you're right. I meant command + shift + control + 3 (full screen to clipboard) and command + shift + control + 4 (partial screen to clipboard).

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

#104
post #83
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.

I like to use `pbcopy` when exporting public keys to external services like GitHub. `cat ~/.ssh/mykey.pub | pbcopy`

You can even simplify this further by feeding `pbcopy` the key directly using file redirection instead of a pipe:

`pbcopy (I use this all the time myself!)

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

#107

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

That's surprising to me as well. I had no idea that caffeinate existed as a native tool on my mac. I've been relying on "Jolt of Caffeine" for the past 3 years.

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

#108
post #22

When mentioning `open` they should have noted that `open ` will open the given file with its associated app. It’s indispensable.

Especially open . if you need to drag a file somewhere. One thing that kind of breaks my muscle memory here is the opposite, something like firefox file.html doesn't work and you have to fiddle with the arguments to get open to launch a non-default application.

If you set

    alias firefox="open -a Firefox"
This will work

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

#109

Caffienate will save my ass going forward. I don't know how many times I end up being the person that runs some batch job on my system...

Here’s a nice GUI wrapper: https://apps.apple.com/us/app/amphetamine/id937984704 (the name might be off-putting to some though)

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

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

Yes. I use it a great deal, but I haven't gotten used to using the linux equivalents. I guess that would be either xsel or xclip. Maybe I should create a "pbcopy" that runs one of those. I like to minimize the cognitive load when I switch between mac and linux command line environments.
Post reply on HN