Handy Ubuntu commands

Untitled document

This page combines a lot of quick commands which can be used in ubuntu.

The purpose of this page is probably more for myself so I don forget handy fixes and configurations in Ubuntu, If it is any use to you please be my guest.

Install ffmpeg with mpeg4 encoding:

http://ubuntuforums.org/showthread.php?t=786095

install Compiz manager:

sudo apt-get install simple-ccsm


Setup sun java under ubuntu:

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

or for a developer:
sudo apt-get install sun-java6-jdk

Now do

sudo update-java-alternatives -s java-6-sun

 


Resolve netbios names :

do:
sudo gedit /etc/nsswitch.conf
change hosts: (add "wins") and store
sudo apt-get install winbind


Install FreeNX

  1. Open your apt sources list

    gksudo gedit /etc/apt/sources.list

    and append the two lines for the repository

    deb http://ppa.launchpad.net/freenx-team/ppa/ubuntu VERSION main
    deb-src http://ppa.launchpad.net/freenx-team/ppa/ubuntu VERSION main

    where VERSION can be: dapper, hardy, intrepid or jaunty. More information can be found at FreeNX Team PPA.

  2. Save and then close.

    To add the public key of FreeNX PPA run:

    sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2a8e3034d018a4ce
  3. Then Update Apt

    sudo apt-get update
  4. After you add the repository, then install the freenx package (using Aptitude to install extra needed packages).

    sudo aptitude install freenx
  5. Now use nxsetup to install necessary files and create the special user "nx"

    sudo /usr/lib/nx/nxsetup --install 

source: ubuntu help files


Setup a SVN server:

do:
sudo apt-get install subversion libapache2-svn

do:
sudo svnadmin create /server/svn
This creates a svn directory in your faforite storage directory, please make sure you have enough room to store all your files.

do:
sudo gedit /etc/apache2/mods-enabled/dav_svn.conf

now edit in this file, it is possibly fastest to uncomment the needed things in this file.
uncomment:

replace /svn with anything you want /svn will result in www.webserver.org/svn

uncomment:
DAV svn

uncomment:
SVNPath /svn and replace /svn with /server/svn or whatever directory you created

uncomment the 3 lines to enable standard authorisation:
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd

uncomment:

save this file and do:
sudo htpasswd -(c)/(m) /etc/apache2/dav_svn.passwd
for each user you want to add, to create user use: -c, to edit use: -m

finally do:
sudo /etc/init.d/apache2 restart


Add a user to Sudo-ers list

to add a user to the sudo-ers list you just have add this person to the admin group:

do:
sudo adduser admin


Build Kscope under ubuntu 9.04

sudo apt-get install qt4-dev-tools cscope exuberant-ctags graphviz

Now we first install QScintilla and build this for the just installed Qt4

QScintilla download

We extract the tar.gz file with tar -xvf QScintilla-gpl-.tar.gz

cd QScintilla-gpl-/Qt4

qmake qscintilla.pro

make

sudo make install

Now QScintilla has been installed

 

sudo ln -s /usr/include/qt4/Qsci /usr/include/Qsci

download the source from http://kscope.sourceforge.net/dload.html

next you need to untar: tar -xvf kscope-.tar.gz

qmake

make

sudo make install

Now you are done kscope is installed

 


Add usb support for virtualbox on intrepid ibex:

just edit fstab with sudo gedit /etc/fstab

add line:

#usbfs
none /proc/bus/usb usbfs devgid=46,devmode=664 0 0

Compiling for the Atmel AVR's

sudo apt-get install binutils-avr gcc-avr avr-libc gdb-avr

and for eclipse integration follow the instructions in this document

http://avr-eclipse.sourceforge.net/wiki/index.php/The_AVR_Eclipse_Plugin


Connecting the AVR jtag MKII to ubuntu

create a file in /etc/udev/rules.d

sudo gedit /etc/udev/rules.d/98-avrJtagMKII.rules

and paste:

# Atmel JTAGICE mkII
SUBSYSTEM=="usb", ENV=="usb_device", SYSFS=="03eb", SYSFS=="2103", MODE="0666"

After saving the file you need to restart udev to reload the rules

sudo restart udev

Now you don't need to do sudo to acces the jtag MKII

Creating and applying patches

to create a patch from an original source tree to an edited source tree, use this command

diff -crB srcv01 Srcv02 > V02.patch
-c stands for context
-r for recursive
-B for ignore white lines

To apply a patch, use the following procedure:
first do a dry run, to check if the patch would work

patch --dry-run -p1 -i V02.patch

If this works then just apply the patch
patch -p1 -i V02.patch


Building linux source for cisco vpnclient:

sudo apt-get install linux-source

cd /usr/src
sudo tar --bzip2 -xvf linux-source-2.6.10.tar.bz2
sudo ln -s /usr/src/linux-source-2.6.10 /usr/src/linux

cd /usr/src/linux

sudo make oldconfig

sudo make

Go to the vpnclient directory...

sudo ./vpnclient_install /usr/src/linux

 


add to /etc/apt/sources/list:
deb http://www.geekconnection.org/remastersys/repository karmic/

 

sudo apt-get update

sudo apt-get install remastersys

 

to make a backup of your system do

sudo remastersys backup

to make a distribution do:

sudo remastersys dist

 


Creating a cool animated desktop

 

download xwinwrap from here

Install the deb file your system requires.

then run the command : xwinwrap -ov -fs -- /usr/lib/xscreensaver/glmatrix -root -window-id WID

The only problem with this command is that it hides your desktop icons.

use this command to place it behind your normal desktop
xwinwrap -ni -o 0.11 -st -sp -b -nf -ov -fs -- /usr/lib/xscreensaver/glmatrix -root -window-id WID

Fast console hacks/scripts:

Some usb devices register as a modem CDC ... /dev/ttyACM0, most serial applications don't detect these devices.
with a simple tweak, the system can create a link to this device in the form of /dev/ttyUSB0.

create a file /etc/udev/rules.d/96-symlinkTTYUSB.rules

And add this string:

KERNEL=="ttyACM*", SYMLINK+="ttyUSB%n"


shutdown pc on shutdown button:

1.- sudo gedit /etc/acpi/events/powerbtn

2.- Add # to comment line: #action=/etc/acpi/powerbtn.sh

3.- Add a new line: action=/sbin/poweroff

4.- Save file

5.- Open a console and type: sudo acpid restart


 

links:

 

setup webdav in apache2:
http://www.howtoforge.com/using-webdav-with-ispconfig-3-on-ubuntu-9.10

setup vpn server
http://forums.bit-tech.net/showthread.php?t=132029

setup SSL on apache:
https://help.ubuntu.com/community/forum/server/apache2/SSL#Ubuntu%207.04

mounting usb devices under virtualbox XP client:
http://www.arsgeek.com/2007/10/24/get-usb-devices-mounted-on-your-virtualbox-xp-machine-in-gutsy-ubuntu-710/
http://www.ubuntugeek.com/howto-install-virtualbox-16-in-ubuntu-804hardy-heron-including-usb-support.html

virtualbox raw xp client:
http://mesbalivernes.blogspot.com/2008/01/virtual-box-booting-from-existing.html

 

install media codecs:
http://ubuntuguide.org/wiki/Ubuntu:Hardy#How_to_install_multimedia_support_on_Hardy_Heron

subversion integration in file system:
http://shaneosullivan.wordpress.com/2007/10/04/a-tortoisesvn-replacement-for-ubuntu/

A newer and better subversion integration into nautilus
http://code.google.com/p/nautilussvn/

A desktop backup tools with gui
http://www.debianadmin.com/backup-and-restore-your-ubuntu-system-using-sbackup.html