Handy Linux Tricks

I am just posting a few of those little usefull commands, links, and utils that make my digital life so much easier:

* What hardware have you got? What version is your BIOS? dmidecode is perfect for this. One that I use regularly is to check the BIOS version without rebooting.

 sudo dmidecode -s bios-version
This command returns something like this:

* Check device usage
fuser (device)
 fuser /dev/dsp

used for finding out what software has control of a given device. Very usefull when tweaking and troubleshooting a linux pro audio set up.

* rsync backups
rsync -avzue ssh (username)@(hostname or ip):/(path to backup)/* (localpath )

This backs up all files and directories on the remote host and copies to the folder you specify.

* Hard Drive Tuning (Linux)
hdparm (options) (hard drive device) For example:
hdparm -c3 -d1 -S36 /dev/hda

This controls the hard drive, specifically I am enabling dma which speeds up the hard drive, setting i/o to mode 3 which also speeds things up. The -S36 sets the drive to spin down after 3 minutes, usefull on my laptop to save battery life (needs lots of ram and don’t forget to unmount your swap partitions with swapoff -a)

There is also the newer sdparm utility that does the same thing for SATA drives.

* Random Star Map Background

kstars –dump –width 1024 –height 768 –filename=~/kstars.png

A randomly generated skymap for a background image. You can run a little script when kde starts up. Simply put the following into your .kde/env folder and make it executable, in your home directory it will create a kstars.png file that you can use as a background. Everytime you start up you will have a different sky map. Change the height and width to suit your desktop.

#!/bin/sh kstars –dump –width 1024 –height 768 –filename=~/kstars.png