
Badassify your terminal and shell - merih
http://jilles.me/badassify-your-terminal-and-shell/
======
bitwize
I don't want my terminal badassified; I want to get work done. Rather than
bling out my command prompt I simply try to do what real developer, data, and
sysadmin badasses do:

* Learn your shell language -- really learn it. Learn how to fit programs together, how to manage jobs, and all of the control structures in your shell language. Avail yourself of aliases and shell functions.

* Learn the Unix command set, sed, and awk. Practice using these tools to do complex data or textual manipulation tasks.

* Make a personal ~/bin directory and add it to your $PATH. Put shell scripts that do useful things in there.

* Learn enough of a real programming language such as C or Python to write small programs to do common things that would be slow or cumbersome to do in shell. Put them in your ~/bin.

There, you'll be Unixing like a boss with a minimum of prompt ricing.

~~~
to3m
Right, sure - but you _definitely_ \- well, probably ;) - still want iTerm2!

For Linux, try terminator:
[http://gnometerminator.blogspot.co.uk/p/introduction.html](http://gnometerminator.blogspot.co.uk/p/introduction.html)
, or your package manager. There are doubtless tons of other options.

~~~
eridius
Why do you definitely still want iTerm2?

The only feature that I find even remotely compelling is mouse support, but so
few programs handle mouse input that it largely doesn't matter. People always
mention split panes, but I've never had a desire to vertically split my
terminal window. If I ever did have such a desire, I'd probably just use tmux.
And yes, iTerm2 claims to have some form of tmux integration, but I _believe_
that's basically just using iTerm2 split panes to represent tmux panes, and I
don't get why that's any better than just using tmux directly.

So besides mouse support and split panes, what does iTerm2 offer that
Terminal.app doesn't? Some of the answers I've heard in the past are "256
colors" and "color themes", both of which Terminal.app supports.

~~~
chipotle_coyote
I've tried using iTerm2's tmux support and found it to actually be _less_
friendly than just using tmux directly. Definitely a YMMV thing, I suppose,
but I was seriously baffled.

One thing I heard from several people in a previous discussion is that iTerm2
makes a thin outline around the terminal window and since they often have
overlapping terminal windows (that are presumably opaque with black
backgrounds), Terminal wasn't as usable. This has changed with Yosemite's
Terminal, though.

~~~
eridius
Huh, I never noticed the very thin outline around Terminal windows in
Yosemite. Neat. I've been using a slightly-transparent dark background with
blur for years (which gets slightly more transparent for background windows).
That always made it really easy to visually distinguish overlapping windows.
But I can see the border being useful for people who have completely opaque
windows (with black backgrounds).

------
austenallred
Warning for newer developers:

I confused myself much more than was necessary when I was first starting out,
because I started using all of these tools like zshell/oh-my-zsh before I
understood what was really going on, specifically with my $PATH. I seriously
spent about a month floundering and becoming increasingly frustrated and
confused before I finally sat down, read the docs, and learned why I should
have been putting stuff in ~/.zshrc instead of ~/.bashrc as a result of using
zshell. If you're still learning the ropes, customizations like this can be
dangerous and time-consuming. Or, at least, you won't be able to just do
whatever the intro docs tell you to do on GitHub and expect things to work.
Those are hoops you don't want to jump through when you're first starting out.

For the more experienced hackers, this warning probably seems amateurish and
unnecessary, but when I was starting I would have been particularly interested
in "badassify-ing" my developer toolkit, not realizing what I was screwing up
and how difficult I was making my future life.

~~~
voltagex_
Would you say it's worth switching to/learning zsh itself? My default has been
/bin/bash for years and years and I find I'm too slow while I'm trying to
learn zsh.

Plus, if you spin up an image on EC2 or DigitalOcean, the default will be
bash.

~~~
cpach
I recently installed fish shell after about 15 years of bash usage. I don’t
think I’ll ever go back to bash on my PC.

I never really customized bash, and fish has so good defaults that I don’t
think I'll customize it much.

Web site: [http://fishshell.com/](http://fishshell.com/)

~~~
0942v8653
Wow. Just looked at the fish docs and it takes the two reasons I almost
started using zsh/omz for, syntax highlighting and completion, and by the
looks of it blows the zsh versions out of the water.

~~~
cpach
The completion is excellent. It just works.

------
alialkhatib
One thing I like about zsh that doesn't seem to get that much attention (and
seems to be overlooked here) is path expansion.

If you're typing a path (let's say to ~/Dropbox/Public/...) you can say "cd
~/d/p" and hit tab to fill in even the intermediate parts. Given that the only
path that matches "~/d. _/ p._" is ~/Dropbox/Public/, zsh will fill that in.
If it hits an ambiguity down the proverbial road, it'll expand until it hits
the ambiguity and list potential matches.

It's really convenient knowing that I can say something like "cd ~/d/c/s/c"
and it'll fill in the rest.

edit: I tried to indicate a basic regex pattern but I think HN is reading it
as trying to italicize "/p." instead. I later tried escaping it with
backslash, but no luck. Sorry if that's really confusing.

~~~
gumby
bash has had this feature too since its first public release. bfox copied from
twenex, which may have gotten it someplace else. Twenex had a great JSYS
(system call) that did full command argument completion that was the
inspiration for the readline library

------
rosser
And what happens when you have to use the terminal on a machine that hasn't
been "badassified"?

~~~
Sonicmouse
Exactly ... Back to basics.

Just learn how to use the terminal in its default form. We've been doing it
for years efficiently.

~~~
tomsthumb
Dude. Optimize for your 99% use case. I spend ten minutes a week on someone
else's machine. Does that really make it a bad idea to remove warts and add
niceties to my machine? Assuming you aren't literally a stump it should be
easy enough to go back to the defaults.

~~~
Dewie
I wonder if it says something about how brittle software and their
interactions tend to be: many very experienced computer users tend to promote
a certain _minimalism_. Not for minimalism's sake, but apparently because
their computers are in such a delicate and brittle state that any superfluous
may brake it, and they have to expend a lot of effort to get it back to that
same state. And also the fact that they aren't able to customize whatever
other machine they have to use for any considerable time, probably because the
administrator won't let you tweak anything (again, because it might
break/introduce vulnerabilities etc. Again, it's in a brittle state).

------
hackmiester
Please do not pipe code from random downloads into your shell!

~~~
akerl_
Instead, only run code from random sites that put time into having a
legitimate looking UI and/or price tag.

Edit: I do wholeheartedly agree with the revised parent comment. Piping things
into your shell is bad practice because it allows malicious _and_ non-
malicious risks to your system. In the malicious case, an attacker can very
easily serve up an innocent script to your browser and a malicious script to
curl/wget. In the non-malicious case, a break in networking midway through the
download can truncate commands, turning "rm -rf /opt/coolsoftware/build" into
"rm -rf /opt".

~~~
hackmiester
Wow, you made me realize I somehow didn't at all write what I meant. I was
referring to piping downloads into a shell. I've updated my comment. Thank
you.

------
cbau
If you _really_ want to "badassify" your shell, check out twosheds, a library
that I wrote for making shells in Python. [1] My motivation was that learning
bash scripting sucks, and it's hard to do many things that should be easy
(like automatically running a command when certain conditions change). With
twosheds, it's just Python, so the limit is your imagination.

twosheds still needs some work to get POSIX compliance, but it's already
usable enough that I've replaced bash with my custom shell, Shell, which I've
hacked to, among other things, print a ton on information on Git's status and
the file system-- I never type git status or ls anymore. [2] If this sounds
interesting, I encourage you to fork it and give it a try.

[1]: [https://github.com/Ceasar/twosheds](https://github.com/Ceasar/twosheds)

[2]: [https://github.com/Ceasar/Shell](https://github.com/Ceasar/Shell)

------
justinmayer
Three suggestions:

(1) Don't use words like "badassify" — they make you sound immature and reduce
your credibility. (c.f. "rockstar engineer", "coding ninja", et cetera)

(2) Invest an afternoon in switching to a static site generator — your site's
current server appears to be on fire due to excess traffic. As a member of the
getpelican.com dev team, I'm clearly biased, but any static site generator
will be better than an uncached Ghost instance.

(3) Try Fish :^) [http://hackercodex.com/guide/install-fish-shell-mac-
ubuntu/](http://hackercodex.com/guide/install-fish-shell-mac-ubuntu/)

------
teamhappy
I switched from oh-my-zsh to [Prezto][1] and I couldn't be happier. I hope
this is useful to some of you.

[1]: [https://github.com/sorin-ionescu/prezto](https://github.com/sorin-
ionescu/prezto)

------
eps
Say what you will about the whole post, but the z script _is_ very neat -
[https://github.com/rupa/z](https://github.com/rupa/z)

------
Walkman
Never heard of zsh-syntax-highlighting before, pretty cool feature! Apparently
it's in zprezto, if you want to enable it, just add

    
    
          'syntax-highlighting' \
    

to your .zpreztorc (below "zstyle ':prezto:load' pmodule \" line)

and uncomment

    
    
        zstyle ':prezto:module:syntax-highlighting' highlighters \
          'main' \
          'brackets' \
          'pattern' \
          'cursor' \
          'root'

------
norswap
I'm actually not convinced by kitchen-sink approaches like oh-my-zsh. It has
so much stuff in it... where do you even begin (except for passive
discoverability stuff like completion -- that's always good to have).

I would be more tempted by adding a few things at a time, piece-wise.
Plundering oh-my-zsh could be an approach: add some parts, see if they're
useful, if they fit in your workflow, else ruthlessly discard them.

------
geetarista
Instead of using the z script, why not just use cd and $CDPATH, which are
built in? I have mine set to this:

export CDPATH=.:$HOME:$HOME/workspace:$HOME/gocode/src/github.com/geetarista

You can set it to whatever you want, then just use `cd` and not worry about
using some other script.

------
hardwaresofton
Some mention of using Tmux (or screen) and powerline would have also been
good.

------
mayneack
seems to be down for me. cached:
[https://webcache.googleusercontent.com/search?q=cache:http:/...](https://webcache.googleusercontent.com/search?q=cache:http://jilles.me/badassify-
your-terminal-and-shell/)

------
pencilcheck
Very cool stuff. thanks

------
jordanpg
I went to look at some of the _amazing_ zsh plugins, and found this
endorsement flashing in front of me: "I just can't imagine not using oh-my-
zsh. I can believe I won't have to mess around with .bashrc again."

And then I wondered: what on earth are you doing in the command line if you
don't want to "mess around with .bashrc"?

I guess the point is to turn the CLI into a mouse-less GUI?

~~~
dennisnedry
Or the fact that it asks you to install iTerm. My favorite thing about
Terminal.app is that it's already there, just a spotlite command away, and you
can theme it as well.

~~~
johnbellone
I personally think that is a moot point because there's usually a whole bunch
of things that I need to install on a Mac, or any system for that matter,
before I can actually be productive on it. At work we have a few shell scripts
that we run through which will install homebrew, various software, and finally
I grab my dotfiles. A full setup usually only takes an hour or two.

