Posts Tagged ‘bash’

Ctrl-left in bash on OS X

October 26th, 2011 Comments off

I finally got my MacBook Pro for work a couple weeks ago and found out how much I actually depend on using ctrl-left and ctrl-right while in bash to move back and forth between words. Yes, I should probably set bash to be in vi mode, but emacs mode is how I learned so why change?

On my MBP that combination does not work. I have no idea what combination it defaults to, but since I constantly bounce between linux machines and this laptop it should be exactly what I’m used to. Thanks to Labrat’s blog post Making BASH’s ctrl-left arrow work on OSX I know now to go to Terminals’s preferences to change this. Once in Settings go to the Settings panel (yes, you read that right) and select the Keyboard tab. The first two entries for Key/Action mappings are for “control cursor left” and “control cursor right”. Double click on each and change the entries to \033b and \033f respectively (hold Esc down for \033).

Edit: I forgot about Spaces which likes “^ Arrow Keys” for switching between spaces. I had to remember to change this to avoid conflicts.

Tags: ,

Dropbox tip: Delayed start

July 1st, 2011 Comments off

Dropbox is a great utility to have handy, especially since it’s multi-platform and I don’t have to think about it. However, I primarily use a Linux laptop which isn’t always Internet-connected or at least not immediately when I login. This confuses Dropbox significantly since the client cannot find the servers and doesn’t retry. But this is nothing a little shell magic can’t fix.

The client starts up based on ~/.config/autostart/dropbox.desktop, which calls dropbox start -i. Based on this NetworkManagerWifiWorkaround tip, replace the Command in Startup Applications with the following and dropbox will wait until your system successfully can ping

bash -c 'while ! ping -q -w5 -c1; do sleep 5s; done; dropbox start -i'

That’s great, except after some time (I believe a restart of dropbox) the command will revert back. So once you have the right command in ~/.config/autostart/dropbox.desktop open up a terminal and run this command:

sudo chattr +i ~/.config/autostart/dropbox.desktop

So now dropbox will wait for you to be connected, and won’t overwrite your change. If you still don’t use Dropbox check out their tour and then signup with my referral link to get an additional 250MB of space.

Tags: , ,