Find large folders

To find the 10 largest folders in the home directory : du -k /home/ | sort -n | tail -10

February 6, 2007 · 1 min · Dave Perrett

Delete files by extension

To recursively delete all files with a given extension (eg all .pyc files in a django application), use : find . -name "*.pyc" -exec rm '{}' ';' Change the “*.pyc” part to delete different file types.

January 2, 2007 · 1 min · Dave Perrett

Splitting up Django models

Create a models folder under myApp. Delete models.py and add a model_name.py file in the models folder for each model model_name. Add the following to each model file : class Meta: app_label = 'myApp' Add a line in models/init.py for each model file : from myModelFile import myModel More information at djangoproject.com

December 31, 2006 · 1 min · Dave Perrett

Shell coloring for iTerm

Create a .bash_profile file in your home directory containing the following : . ~/.bashrc ENV=$HOME/.bashrc export ENV export TERM=xterm-color alias ls='ls -G' alias ll='ls -hl'

October 4, 2006 · 1 min · Dave Perrett

Recover Corrupted Svn DB

To recover your repository if you’re getting Corrupted error messages : $ sudo svnadmin recover /home/svn/repository/your_repository_name

September 28, 2006 · 1 min · Dave Perrett

Get SVN Revision No.

Simple one-liner for getting the svn revision number - useful for shell scripts : svn log --revision "HEAD" | head -2 | tail -1 | awk '{print $1}' | cut -c 2-

September 27, 2006 · 1 min · Dave Perrett

Installing Subversion

Update There is a better walk-through for installing subversion with apache here . ...

September 27, 2006 · 3 min · Dave Perrett

Useful .bashrc Functions

A couple of useful functions for .bashrc : ...

September 27, 2006 · 1 min · Dave Perrett

Turn On Vi Syntax Coloring

Firstly, check that the vim-enhanced package is installed : rpm -qa | grep vim You should see something like : ...

September 26, 2006 · 1 min · Dave Perrett

Useful Vi Commands

...

August 18, 2006 · 3 min · Dave Perrett