Live data from Hacker News

Badassify your terminal and shell

jilles.me

11–20 of 54 posts

Re: Badassify your terminal and shell

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

Re: Badassify your terminal and shell

#12
post #2

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

You take a few minutes to get used to/remember how to use that terminal?

Not all of us are system administrators who need to be able to work on any Unix system at any times notice, and can only rely on things like ed being installed on them (That's at least the complaint I've read a lot of from people who are against some customization, or learning some kind of non-standardized/ubiquitous program. But what if you get stranded in the Sahara with no laptop, and you have to use a AT&T UNIX PC because the bedouins don't have anything else, and you desperately need to fix something on some boxes 1,000 miles away? Where's your fancy colour schemes new?).

Re: Badassify your terminal and shell

#13
post #6

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?

How the hell is that the takeaway from the article? That's the most disingenous read possible. Ass.

Re: Badassify your terminal and shell

#14

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

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".

Re: Badassify your terminal and shell

#15
post #14

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

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.…

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.

Re: Badassify your terminal and shell

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

Re: Badassify your terminal and shell

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

Re: Badassify your terminal and shell

#19
post #6

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?

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.

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.

Re: Badassify your terminal and shell

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

Post reply on HN