Live data from Hacker News

OS X Command Line Utilities

mitchchn.me

211–220 of 243 posts

Re: OS X Command Line Utilities

#212
post #91

Earlier quoted context omitted.

iTerm2 does vertical and horizontal splitting better than Terminal.app. tmux does vertical and horizontal splitting better than screen. That's my rationale for using iTerm2 and tmux instead of Terminal.app and screen. (yes, I'm aware that screen has improved its splitting recently, but I switched to tmux in 2011, after seeing a presentation about it by Nicholas Marriott)

Why split your terminal if you have screen / tmux?

Copy and paste support mostly.

Re: OS X Command Line Utilities

#213

Personally, I was surprised that there is not a command line interface to OS X's Notification system. Seems like it would be handy for long running batch jobs.

Install this:

https://github.com/alloy/terminal-notifier

Add this to your .bashrc:

function notify { terminal-notifier -title "$1" -message "$2" }

Re: OS X Command Line Utilities

#214

This was supposed to be few lines of remarks. It expanded quickly in relation with my enthusiasm for this topic. I've been investing some time in the command line on my Mac. I am moving from a dilettante going to the shell on a per-need basis to a more seasoned terminal native. It pays off handesomely! It's hard to convey how nice it to have to have a keyboard-based unified environment instead of a series of disjoine…

> - Install iterm2. The main reason to use it >instead of the default Terminal application is that It just works©. What's wrong with the default Terminal application? I use it daily and have been for close to a decade. I never found myself wishing it did anything than what it already does. > -Use tmux. Meh. For most people screen works just as well. Perhaps more importantly, you can rely on screen being available pre…

Actually, those two points are related: I started using iterm2 precisely because I also started using tmux, and tmux integration is much better with iterm2 than with the native terminal (and for me at least I find tmux much simpler than using screen). So there are advantages.

> Speaking of which: vim is great. Use vim. The world needs more vim.

Agreed :)

Re: OS X Command Line Utilities

#215
post #140
post #104

Earlier quoted context omitted.

When i first found out about pushd and popd, i loved them, and used them all the time. These days, i never use them. The way i work now is that i have a bunch of terminal tabs open. Each tab has a shell which pretty much just sits in a single directory. If i need to switch to a different directory, i switch tabs. A nice effect of this is that each tab builds up a recent shell history specific to the directory it sits…

I have the same workflow for switching between tabs, although on Mac the default keyboard shortcut for switching Terminal tabs (Cmd + Shift + '[' or ']') was a little too cumbersome. I swapped it out with (Cmd + '[') which by default will take you to the next Terminal, not tab. I move left to right more, so it made more sense for me. Easy enough to change in system preferences, though. And with using Vim NERDtree, or…

I am on Mac, and i have to confess i just use the trackpad to click on the tab like some sort of caveman.

Although, now ripter has taught me that ⌘1 etc select tabs (i also use iTerm), i hope i'll switch to using that.

Re: OS X Command Line Utilities

#216

Why the hell would someone change the title from "Eight Terminal Utilities Every OS X Command Line User Should Know" to "OS X Command Line Utilities". The original title is clearly more accurate / useful / canonical. The overwritten title is ambiguous. This is indeed not a list of every OS X command line utility.

HN has a blurb in the guidelines about "number (rest of the title)" articles being rewritten. Never understood it or the reason why, but there you go.

Re: OS X Command Line Utilities

#217
post #36

I didn't know about `screencapture`. That's a fun one. The Linux equivalent of `open` is `xdg-open`. I usually alias it to `op`, since `/bin/open` exists. Another bit of terminal-sugar for OS X users: alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend' And most Linux users: alias lock='gnome-screensaver-command -l' If you find yourself accidentally triggering hot co…

Additional, Linux equivalents of pbcopy/pbpaste are available in a number of competing utilities such as xcut, xclip and xset. Unfortunately none of these are installed by default on standard installations, at least not on any common distribution I've ever seen.

Re: OS X Command Line Utilities

#218
post #213

Personally, I was surprised that there is not a command line interface to OS X's Notification system. Seems like it would be handy for long running batch jobs.

Install this: https://github.com/alloy/terminal-notifier Add this to your .bashrc: function notify { terminal-notifier -title "$1" -message "$2" }

Interest. Thank you.

Re: OS X Command Line Utilities

#219
post #108

Earlier quoted context omitted.

Quicksilver is similar to Alfred in intent and quite featureful/customizable. It is open source. https://github.com/quicksilver/Quicksilver

Quicksilver used to be great, but then the main developer went to work on some dead end project for Google and abandoned Quicksilver. Is the project still alive? It's too late for me anyway - I have moved to Alfred, the new kid on the block at the time, and like it much more (much less clutter). Plus, I can't trust the QS developer anymore after he's abandoned the project once.

As far as I know, Quicksilver has been taken over by another team, and is in constant development at the moment.

I know because I regularly see "Quicksilver has been updated" messages ;)

Re: OS X Command Line Utilities

#220
post #86

Earlier quoted context omitted.

But the open command doesn't allow you to pass the environment, and Apple seems hellbent on breaking every workaround they've implemented over the years (e.g. ~/.MacOSX/environment.plist). So, doing Foo.app/Contents/MacOS/Foo is often the only way to launch a GUI app while inheriting the full environment that you have on the command line. I often have to do this to launch various developer tools, and have them be abl…

> But the open command doesn't allow you to pass the environment Uh? I’ve been using open to pass NSZombieEnabled and other debugging stuff to apps all the time and it works. From man open(1): Opened applications inherit environment variables just as if you had launched the application directly through its full path. This behavior was also present in Tiger.

What?! Awesome! I would swear that was once not the case... (checks man page)

    Opened applications inherit environment variables just
    as if you had launched the application directly through
    its full path.  This behavior was also present in *Tiger*.
Sigh, I'm old...
Post reply on HN