Linux


Okay…it looks like I’ll be moving again, but this time (hopefully) will be the last. “What’s the new URL?” you ask avidly, drooling over the thought of more nerd tech stuff. Well, I’ve dropped the Simplicitas title and decided upon CliftonSnyder.net. Original, no? Look there for future posts, because this bird has flown the coop!

(Thanks to WordPress.com for setting up this excellent service, and WordPress.org for the dirt-simple blogging software powering both WordPress.com and CliftonSnyder.net!)

This may be pure, unadulterated navel-gazing, but I thought that if I didn’t have a post about the progress page that I’ve created for The eBayowulf Cluster then nobody would end up seeing it. (Who really pays attention to all the junk tucked away in the sidebar, anyway?) Check back for updates!

Just about any modern text exitor has a way of creating backup files. As any Emacs or jEdit user will tell you, one of the simplest (and at times one of the most annoying) ways of going about this is to create a file with the same name as the original, and append a tilda (~) to the end of the filename. When editing several files in different directories, this can lead to a whole mess of tilda-files lurking around, taking up space and just generally making a nuisance of themselves. Instead of manually searching through all of my directories and removing these files by hand, I’ve made use of the find command to run search-and-destroy missions these tilda files. All I did was add this line to my .bashrc:

alias emacs-clean='find . -name '*~' -exec rm {} \;'

Pretty simple, really. Note that this will not, however, remove any dot-tilda-files (backups of “hidden” files prefixed with a “.”; e.g., .bashrc~) that happen to be hiding out in your directories. To take care of these, you could add the following to your .bashrc:

alias dot-emacs-clean='find . -name '.*~' -exec rm {} \;'

Now you can happily edit away without worrying about those irksome tilda-files. Happy coding!

Update: It was brought to my attention that the correct spelling of the word is ’tilde’. However, since I’m unwilling to change my pronunciation of the word from ’til-duh’ to ’til-deh’, I’m equally unwilling to change the spelling of the word in this post. Thanks anyway, Bob! :-)

Update: I’ve since made a change to my emacs-clean script so that it includes dot-files. I use the -or flag, like so:

alias emacs-clean='find . -name "*~" -or -name ".*~" -exec rm {} \;'

I stumbled upon Ubuntu Blog today (one of today’s “Hot Blogs” on the WordPress.com main page).

Ubuntu is, in my humble opinion the easiest and best way to switch from Windows to a free/open-source operating system. In order to make your transition easier, and to help those that have started using ubuntu, this weblog will feature a series of articles with tips and tricks.

Most of the “tips and tricks” so far are fairly Ubuntu-specific, but some of it might be of general use to linux users. Check it out!

…for the terrible formatting of the previous post. It would seem that WordPress doesn’t like me attempting to use styles/CSS – not even styles included in the stylesheet currently attached to the page. Hopefully I’ll get something better figured out soon…

Update: Patched!

I might have unopened mail strewn about my kitchen table, but when it comes to my home directory, I’m a bit of a neat freak. Maybe it’s because I’ve symlinked my Desktop directory to my $HOME:


cd
rm -rf Desktop
ln -s . Desktop

and I can’t stand to have things littered about my desktop, but things have got to be organized in an understandable hierarchy or I start to get a bit twitchy.

Another thing that bugs me is those pain-in-the-neck but vitally important dot-files that *nix users have come to know and love. Since I’ve got my ~ organized with the standard *nix directories (~/var, ~/bin/, ~/src, …) there’s obviously got to be a ~/etc, right? …and what better place than that to put one’s configuration files? So, in comes mketc:


#~/bin/bash

# mketc - creates a ~/etc directory in and populates
#       it with links to all of your ~ dot-files

# first we gotta make the dir, if it isn't already there
if [ ! -d $HOME/etc ] ; then
    mkdir -p $HOME/etc
fi

# chdir to the new etc directory
cd $HOME/etc

# for each dotfile in ~
for file in `ls -d $HOME/.[a-zA-Z0-9]*`; do
    etcfile=$HOME/etc/${file:${#HOME}+2}

    # if it's a directory, we must symlink it
    if [ -d $file ] && [ ! -e $etcfile ] ; then
      ln -s $file $etcfile
    # if it's a regular file, we can hard-link it
    elif [ -f $file ] && [ ! -e $etcfile ] ; then
      ln $file $etcfile
    fi
done

Essentially what this does is create a ~/etc directory (if it doesn’t exist already) and populates it with links to all of the dot-files in your $HOME directory (minus the dot, of course).

An important thing to note about this script is that it hard-links regular files, and symlinks directories.

“Why not just hard-link everything?”

you ask? Good luck trying to hard-link a directory without superuser priveleges (or even with root!).

“Well, then why not symlink everything?”

The simple answer to that is differentiation when using a color-enabled terminal. Granted, the color scheme won’t adhere to what one is used to (since all of the symlinked directories will be colored as symlinks, as they should be), but at least you’ll be able to tell what’s a file and what’s a directory. Also, any regular file type/permissions colors that you happen to have in place will still be available.

Enjoy!