Live data from Hacker News

OS X Command Line Utilities

mitchchn.me

141–150 of 243 posts

Re: OS X Command Line Utilities

#141

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…

Thank you very much for this write-up and post. I am in a similar boat you are -- every month that passes as a developer makes me hungry to automate those repetitive tasks I do every time I develop something.

I also think this sentiment will be growing. I think there's a large disconnect between "traditional" UNIX users and people entering from the web / Rails / other kinds of worlds, and that gap is slowly shrinking. That's why we are seeing things like npm tools (bower, grunt) replacing makefiles, Docker replacing traditional sysops, the whole idea of "DevOps" as a thing vs "IT".

I'm very very excited about this transition and want to help be a part of it. I think I'm going to write a similar tutorial outlining my current mac / terminal workflow.

Re: OS X Command Line Utilities

#142
post #87

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…

Another trick I learned from an older HN comment is to create a .marks directory in your home directory and then add the following to your .zshrc export MARKPATH=$HOME/.marks function jump { cd -P $MARKPATH/$1 2>/dev/null || echo "No such mark: $1" } function mark { mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1 } function unmark { rm -if "$MARKPATH/$1" } function marks { ls -l $MARKPATH | sed 's/ / /g' | cut -d' ' -f…

I have a minimal take on this: j to jump to any directory below ~/Projects. Supports tab completion, as it should.

https://github.com/mattgreen/dotfiles/blob/master/zsh/jump.z...

Re: OS X Command Line Utilities

#143

no love for macport?

My understanding is that macports is a lot more finicky and hacky, especially when it comes to built-in dependencies. homebrew is specifically designed to avoid such problems.

YYMV but I've been using Macports for 3 years and never had the impression it was finicky or hacky or had any problems with it really.

Re: OS X Command Line Utilities

#144

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…

Instead of doing the sym link think manually there is a great script that is stupid simple to use and only a few lines in your zshrc/bashrc file. It's called jump/mark. I aliased j to jump and added tab completion to zsh and it's made all the difference. Usage Mark . Marks the current directory to be in the jump list. Jump Jumps to that directory. Zsh is a much nicer shell than bash too and there are no glaring incom…

Specifically for jump, from my .bashrc:

    export MARKPATH=$HOME/.marks
    function jump {
        cd -P $MARKPATH/$1 2> /dev/null || (echo "No such mark: $1" && marks)
    }
    function mark {
        mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1
    }
    function unmark {
        rm -i $MARKPATH/$1
    }
    function marks {
        ls -l $MARKPATH | sed 's/  / /g' | cut -d' ' -f9- && echo
    }
    _jump()
    {
        local cur=${COMP_WORDS[COMP_CWORD]}
        COMPREPLY=( $(compgen -W "$( ls $MARKPATH )" -- $cur) )
    }
    complete -F _jump jump

Re: OS X Command Line Utilities

#145

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…

Been loving vim for several years. Finally decided to learn emacs, partially spurred by interest in clojure.

It seems that as more languages are created that include native repl experiences, emacs becomes more appealing to me because it fits nicely with editor+repl, where in other editors a repl seems more of an afterthought or nice-to-have.

I would say definitely learn vim first, but it's great to know both vim and emacs. It just opens up more doors.

Re: OS X Command Line Utilities

#146

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…

Look into getting Emacs in one of its native OS X incarnations rather than using it in the terminal. Emacs is going to have a lot more options for colors (font locking is the Emacs-speak, I think) in its own app than when it's boxed into a terminal. You also get support for multiple "frames" (windows); Vim can't do this at all and I still miss that from Emacs. I use Linux rather than OS X but if you are parked in Ema…

unless you are remote, then the terminal emacs + tmux are a good combo.

Re: OS X Command Line Utilities

#147
9. /usr/sbin/system_profiler

10. /System/Library/CoreServices/Applications/Wireless Diagnostics (with built-in wifi stumbler)

11. /System/Library/CoreServices/Screen Sharing.app (Built-in VNC client with hardware acceleration)

12. /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources (Command-line wifi configuration and monitoring tool)

Combine with sed, awk, and cut, and these tools can provide useful monitoring.

Re: OS X Command Line Utilities

#148
post #12

/usr/local is the default location for user-installed stuff, but I personally like to have my package manager do its stuff in a separate directory. I like the way Fink [1] uses the /sw (software) directory. Does anyone have a valuable opinion on the comparison between Fink and Homebrew — or maybe MacPorts? [1] http://www.finkproject.org

I agree about staying out of /usr/local. I install stuff there -- I don't want my package manager taking it over. That's kept me away from Homebrew.

Re: OS X Command Line Utilities

#149
pbpaste and pbcopy can specify multiple clipboards; one very handy thing I do is

"cmd-a" "cmd-c" (copy all)

double click on a word I'm looking for, "cmd-e" to enter it into the find clipboard

'pbpaste | fgrep --color `pbpaste -pboard find`'

I have that aliased as 'pbg'.

Re: OS X Command Line Utilities

#150

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…

Instead of doing the sym link think manually there is a great script that is stupid simple to use and only a few lines in your zshrc/bashrc file. It's called jump/mark. I aliased j to jump and added tab completion to zsh and it's made all the difference. Usage Mark . Marks the current directory to be in the jump list. Jump Jumps to that directory. Zsh is a much nicer shell than bash too and there are no glaring incom…

More information on jump and mark available at: http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-f...

Basically there is a jump oh-my-zsh plugin, but be sure to add the auto-completion mentioned in this article too...

Post reply on HN