'Linux' Archive

Treating hidden files right

August 26th, 2011

Warning, this is reasonably geeky stuff but nothing that’ll blow anyone’s minds. I’m a fan of DRY as a principle and I’m lazy.

If you’re on a linux variant then you know how key those wee little hidden files are to your life. I want my dotfiles sync’d across machines. I don’t want to have to mirror changes across machines or cp them onto new installs etc. For that reason I’ve long stored my core dotfiles under version control of some kind, svn, hg, blueturbine, whatever. If you’re not already doing this, please start. Sites like bitbucket offer free private repositories so no excuses.

That handles versioning but what about mirroring etc? In my case, I symlink my dotfiles to wherever that repository is. I keep a simple script to setup those symlinks on new machines.

Here’s an example script. Running this script blows away existing dotfiles on the current machine, by moving them into tmpDir, and creates symlinks to your versioned dotfiles. Now modifying and committing changes in one environment impacts all your setups.

There are a few formal projects out there for this but this simple solution works for me. Related, dotfiles.org is a site for sharing dot files.

# homeDir: home directory where dotfiles are located.
homeDir="/home/guyman"
# configDir: location of actual dotfiles, ie your repository dir.
configDir="/home/guyman/hg/config"
# tmpDir: A temp dir to dump files.
tmpDir="/tmp"

echo "moving any existing files into $tmpDir"
mv $homeDir/.vimrc $tmpDir/.
mv $homeDir/.bashrc $tmpDir/.
mv $homeDir/.ssh/config $tmpDir/.

echo "creating sym links"
ln -s $configDir/.bashrc $homeDir/.bashrc
ln -s $configDir/.vimrc $homeDir/.vimrc
ln -s $configDir/.ssh/config $homeDir/.ssh/config

I Like to Watch

January 24th, 2009

In the category of lovely commands you may not know about, the watch command. You can take almost any command and throw watch in front and it will recurse for you. A quick example: You’re copying or ftping a large amount of files into /tmp directory and you want to keep an eye on the progress. Let’s say you’re also interested in file details so this will give you a snapshot:

ls -lh /tmp

To keep an eye on it, just prefix with watch:

watch ls -lh /tmp

Default is to rerun every 2 seconds which is a bit much for this. The following will run every 30 seconds allowing me to keep a watch on progress:

watch -n 30 ls -lh /tmp

ubuntu, ATI and two monitors

October 8th, 2008

Working on an open source OS can be empowering. Most everything you’d like to do has a relatively simple solution with a common sense approach….IF you can find it. The challenge isn’t about having the freedom of possible solutions, it’s about being able to find, interpret, and judge a multitude of possible solutions in order to determine what the best solution is to a problem you’re experiencing.

A recent example? I’ve always ran 2 monitors on my desktop at home using an nVidia card which is notorious for offering better support to linux based systems. My new office desktop shipped with an ATI card. If you read enough, you could easily find yourself buying a new nVidia based card to solve this one. I strayed for a while on overly complex solutions, installing multiple packages from source etc, until finally landing on a one line solution.

“aticonfig –dtop=horizontal”

With that I have both monitors running beside each other as a single desktop. Simple but unusually complicated to find.

Pushin and Poppin

July 20th, 2008

Related to super cd, if you don’t already know about pushd and popd then read up as they’re helpful as well…

“The pushd command saves the current working directory in memory so it can be returned to at any time, optionally changing to a new directory. The popd command returns to the path at the top of the directory stack.”

If you end up using these commands then I highly recommend this tip.

Super cd

July 20th, 2008

I pitched the idea a while back to a friend for a super cd. The idea being to add a means of easily creating, managing, and using shortcuts to directories you often use. I currently handle this by creating aliases in my .bashrc like this one:

alias cddir=”cd /home/some/directory/used/a/lot”

It’s a pain, however, to manage them, recall what I named one, delete old ones etc. So my thought was to build a python program to wrap cd. You could then use some special syntax like hashing to reference shortcuts. So typing “cd #dir” would move you into the directory you saved under shortcut “dir”. If super cd didn’t feel the command was meant for it then it would simply pass the request down to the base cd.

While sitting here in Vancouver sipping a tasty americano, I finally got around to some searching to figure out how I could change directories in a shell by calling into a python script. Not quite as simple as it first seems. In searching for that I not only found the answer but I found almost the exact tool I was about to write. Adding to the weirdness is the fact it appears to be written by a guy here in Vancouver.

If you use a shell, try go. While not exactly what I had planned, it allows you to type “go -a dir” to add the current directory. Then type “go dir” at any point later to change back to that directory. I like…

Painless Upgrade

April 26th, 2008

A new ubuntu release, hardy heron, is out, lifehacker review.

synaptic1.pngI know I’ve said this before but synaptic, and apt-get, is the coolest piece of software I’ve come across in years. Finding, installing and maintaining software is a magnitude simpler on ubuntu than any other os. An example is this recent release. I’m about to download, install etc with one click of a button while on a wireless network. A dream.

gnome-do stuff

April 14th, 2008

I have a new favourite, and one of my most used, applications. First, a quick history. I don’t like using a mouse and I don’t like menus, especially start menus. To avoid start menus I used to start most apps from a shell by creating a multitude of alias that I’d have to remember.

After that I moved onto using katapult which was better but flaky, likely because it was built for kde not gnome.

After that I moved onto deskbar-applet which I still use a bit today. I believe it comes on the ubuntu base install so you usually have it from the start.

I’m now using gnome-do for all this and it’s the slickest one yet…

“GNOME Do allows you to quickly search for many items present in your GNOME desktop environment (applications, Evolution contacts, Firefox bookmarks, files, artists and albums in Rhythmbox, Pidgin buddies) and perform commonly used actions on those objects (Run, Open, Email, Chat, Play, etc.).”

It’s inspired by, which all the above are, Quicksilver. Gnome-do has done the best of them all. If you’re on a linux OS and haven’t yet, give it a try.

Epiphany II

March 3rd, 2008

SOLD! One of the few reasons I’ve jumped to my vmware windows instance over the past few months has been to watch tsn highlights. The have a new slick looking beta video player that gives me nothing but “Sorry, there was an error
We are experiencing temporary difficulties downloading your lineup. Please wait another few seconds then try again. Thanks for your patience.”

I expected nothing but the same from epiphany but gave it a shot anyway and it works!! Finally, hockey highlights at my finger tips. I’m guessing this is somehow related to being a tighter integration with gnome? It’s a tricky balance. On one hand, it makes sense to build something like firefox to work across platforms but in other cases I just want something that works on my machine and I don’t care how tightly coupled it is.

New Browser Epiphany

March 3rd, 2008

I’m starting to figure out that I’m flighty when it comes to browsers. I just installed and started playing with epiphany

“Welcome to the Epiphany wiki! Epiphany is the easy-to-use GNOME web browser. With Epiphany, you can Search by typing in the location bar and organize Bookmarks by category. Its clean Preferences window makes finding and changing useful options a breeze.”

So far I really like it. It’s just simpler and works better which is a rare combination in software. I was able to immediately integrate my delicious bookmarks and through the location field only I’m able to quickly navigate my bookmarks, search the web, goto a url etc. Currently in firefox I needed two fields, location bar and search box, to accomplish that.

This part’s cool if you like python. One extension is a python console that allows you to start messing with the browser itself through the epiphany api. There’s an example here that has you editing the browser title bar, browsing to a page, etc in one liners.

Linux Blogging Client

November 1st, 2007

This entry was posted using the gnome based blogging client Drivel. More details here.

Why bother with a blogging client? The main reason for me is drafting posts offline and then being able to easily post them. Typically I write up basic txt files for that purpose, however, that means I have to copy, paste, and edit when I want to actually post. With drivel I can save locally and then post anytime I’m connected.

Just to test it out, this is me editing this existing post with drivel. I was going to add that drivel is clean and simple which are attributes I like in my software. Another nice feature is that if you post to multiple blogs running on varied blog engines then you have a consistent interface for posting.