Saturday, October 6, 2012

.bashrc, .bash_profile

While I've learned some nice bash tricks during the past few months, I haven't really gotten to customizing it or really understanding how it works from the bottom up. .bashrc and .bash_profile, for example, are two files close to the boundary of my current understanding of bash's structure.

I don't know how they really work just yet, but as I looked for how to implement bash aliases, I bumped into these sample .bashrc and .bash_profile files, which seem to illustrate bash's ample functionality comprehensively. I'll be honest, I haven't really read even five lines of it, but it seems like a super useful bit of text. Here's the link:


The website seems to be the Linux Documentation project, so I doubt it'll be going away anytime soon. (I was considering copy-pasting its contents, but that seems a bit over-paranoid).

Key repeatssssssssssssssssssssssssssss

I bump into this occasionally, but when I do, it irks me. By default on my OS X, if I press and hold the "a" key, instead of getting a long line of a's, I get this little window:


which sucks. If I wanted to type รก, I would've known it in advance and have pressed the special Option-E + A, or configured my keyboard for Spanish-style input, or found it on a web page somewhere and plagiarized it for my shameless personal gain (as I often do for arcane characters like ☮ and  ). If I wanted to type something like

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

without having to press the "a" key 81 times. I'd much prefer to instead press the "a" key, hold it for 5 seconds, and be done with it. Yes, I could do it on Terminal, but it's slow to switch to another application every time I want a specific kind of keyboard input.

So today I was browsing around, looking for a way to be able to execute binaries on the current directory, from the Terminal, by typing only their names, and not having to type in "./" at the beginning of the line (you know what I'm talking about). I haven't yet found that, but I bumped into this page:

http://mac.tutsplus.com/tutorials/terminal/10-terminal-commands-that-every-mac-user-should-know/

which among other sometimes-useful tips, taught me how to disable that sucky little key-hold window for the Mac OS X GUI:

defaults write -g ApplePressAndHoldEnabled -bool false

To be honest, I have not tested it (it requires logging off and on again), but I see no reason why it shouldn't work. Enjoy!