How to: Create a new wine prefix or bottle

When running Windows apps under Linux via wine, it’s always a good idea to have each app in it’s own sandbox or wine bottle if you will. After you get an app running with wine, you can store the bottle and grab it from the cellar when you need it.

A wine bottle, is similar to a clean windows install. When creating it, you can specify if the architecture should be 32 or 64bit, which basically emulates a 32 or 64bit machine with windows. You can also keep for each bottle individual settings via winecfg.

Here is how you can create one:

winearch=win32 WINEPREFIX="/opt/cellar/civ5" winecfg

This will create a clean 32bit wine prefix, stores everything in the “/opt/cellar/civ5″ folder and opens the winecfg app for that prefix. Note that in order to use that prefix, you must always make sure you specify it:

winearch=win32 WINEPREFIX="/opt/cellar/civ5" wine notepad

I keep all my wine bottles on an external HDD mounted under /opt/cellar. As long as the correct wine version is installed on each machine for that bottle, i can take the HDD and use the apps on any Linux machine.

How To: Delete ALL older kernels

If you are using Ubuntu, there is a good chance you get kernel upgrades once in a while. There is no reason, after you’ve booted the new kernel and verified that everything is working properly, why you should not delete all older kernels. This will free up a bit of that root partition. If you are like me and mount / on a small SSD partition, every MB counts. For me the modules for each kernel version are around 160MB.

Here is a CLI one-liner to delete all order kernels, leaving only the latest on the system:

sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')

Fix VMware Workstation Module compile error on Ubuntu/Debian Linux

# Become root
sudo -i

# Do a couple of pre-requisites
apt-get install build-essential
ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

# Extract each of the VMware module packages

cd /usr/lib/vmware/modules/source
for file in *
do
tar xvf $file
done

# Fetch and apply patches required for this release...
wget http://communities.vmware.com/servlet/JiveServlet/download/2234875-108182/vmci.linux-3-8.patch
patch -p0 < vmci.linux-3-8.patch

# Put the VMware module source packages back together again
for file in *-only
do
tar cvf `basename $file -only`.tar $file
done
rm -rf *-only

# Tell VMware to rebuild the modules - can also just run the command "vmware" as root
vmware-modconfig --console --install-all

Real time folder monitoring in CLI Linux

I needed to see the changes to a folder in realtime and after a bit of looking around, i’ve found this solution:

 watch -d -n 1 'df; echo " "; echo "Local folder updates:"; ls -FIAt;'

If you want to refresh at longer intervals (not 1s as it is now) all you have to do is change the value of the -n parameter as so:

 watch -d -n 10 'df; echo " "; echo "Local folder updates:"; ls -FIAt;'

This will show you the changes to the current folder every 10s.