Friday, June 29, 2007

synchronize files between laptop and usb disk

following is the command i used to synchronize music files on my laptop and external usb disk. /share/music/files/ is the path on my laptop.

rsync -avzC /share/music/files/ /media/usbdisk/music/files
-a == archive
-v == verbose
-z == use compression while transferring files
-C == exclude common CVS files and directories
trailing / on a path means to only copy the contents of that path

restart services after update

how do i know which services need to be restarted after a system update? in the package debian-goodies is a program named checkrestart. run this program as root and it will print out the daemons that need to be restarted.

allow a user to mount a usb drive

i wanted to use rsync ( a cool synchronization program) to keep the music files on my laptop and external usb disk in sync. the problem i ran into was that root was the only user that can mount and umount a drive. after mounting root would own all the files on the usb drive and i could not rsync my files without doing a chown recursively on the usbdisk or letting root own all of the music files on my computer.

after reading the man page on the mount command i found a line that reads: "Normally, only the superuser can mount file systems. However, when fstab contains the user option on a line, anybody can mount the corresponding system."

problem solved

Wednesday, June 27, 2007

keyboard shortcut to launch web browser

i want to use a keyboard shortcut to launch my web browser. i'm currently using Gnome on a Debian system. on the top panel choose Desktop -> Preferences -> Keyboard Shortcuts. in the keyboard shortcuts window, select Launch Web Browser and enter the desired key combination. i chose ctrl-alt-w as my key combo.

when i used my key combo the first time it launch a gnome web browser. i would prefer to use opera or firefox, so i needed to modify which browser the key combo fired off. after googling i discovered a mechanism called alternatives. this is basically a set of symbolic links divided into catagories that can be configured. if you execute update-alternatives --list gnome-www-browser you get  /usr/bin/firefox and /usr/bin/w3m printed out. you can modify which alternative is chosen.

there is a gnome gui version called galternatives. use apt-get or another package manager to install it. then execute galternatives from the command line as root. select a category in the left side pane and choose an alternative in the right side pane or a new alternative by providing the path of the executable. so i chose gnome-www- browser, clicked the add button and entered /usr/bin/opera. close out galternatives and press my key combo. now opera is launched with ctrl-alt-w.

synchronize usb drive with laptop in linux

below is the command i used to synchronize the contents of my usb thumbdrive with a shared directory on my computer

>rsync -Cavz --delete /media/usbdrive/ /share/syncDir/
     -C == excludes cvs directories
     -a == archive, preserves pretty much everything recursively
     -v == verbose
     -z == compresses data, only necessary when dealing
          with a remote connection
     --delete == deletes files at the destination that are not at the
          source, read man page for more control
     --dry-run == print result to stdout without actually executing
          the sync

how i fixed my no sound problem in Debian

i recently install Debian my laptop. i had trouble getting xmms to play sound. after much googling i had to install the appropriate alsa packages, execute alsaconf, and add my user to the audio group (adduser username audio). this seemed to do the trick.