Friday, 22 February 2008

Extracting rar files in Ubuntu

Strangely all the distributions of Linux that I've used don’t come with an application to decompress rar files on the command line. To install a simple application to decompress them in Ubuntu type:
sudo apt-get install unrar
Once installed you can decompress your rar file by typing:
unrar x <File>
Where <File> is the name of the file you want to decompress.

Tuesday, 19 February 2008

Installing Starlink/GAIA/Photom on Ubuntu

To start off install the dependencies. Starlink requires C Shell (csh) to run. C Shell is an alternative to the more commonly used bash. To install C Shell type the following:
sudo apt-get install csh
Once installed download the latest version of Starlink. Once your download has finished untar it to /usr/local/bin (Remember to change Linux-32bit-glibc2_5.tar.gz to which ever version you downloaded):
sudo tar -zxvf Linux-32bit-glibc2_5.tar.gz -C /usr/local/bin/
The final step is to source the Starlink profile to set up the environment variables needed by Starlink. This can be done automatically for you by editing your bashrc file. This file is executed every time bash starts, such as when you log in. To edit your bashrc file type:
gedit ~/.bashrc
Add the following to the bottom of your file then save and exit.

#source the Starlink profile so we get the Starlink env vars
STARLINK_DIR="/usr/local/bin/star-namaka"
source /usr/local/bin/star-namaka/etc/profile

You will need to change “namaka” to whatever version you’re using.

Restart your console to let the new environment variables kick in and then you can run your Starlink applications using one of the commands:
gaia
photom

Wednesday, 6 February 2008

Installing NVIDIA Drivers in Ubuntu

Unlike many other video card manufactures NVIDIA produces easy to install drivers for Linux.

To install your NVIDIA card’s drivers first download the correct driver for your card from the NVIDIA website.

Before you start your installation make sure you have the package libc6-dev installed. To do this use the command:

sudo apt-get install libc6-dev

To start installing the driver you will need to kill your xserver. This will mean you will no longer have access to your GUI so it will be a good idea to print out these instructions before doing so.

To kill your xserver just stop the process. If you are using the KDE desktop type:
sudo /etc/init.d/kdm stop
Or if you are using Gnome desktop type:
sudo /etc/init.d/gdm stop
Your GUI will disappear and be replaced with a simple text prompt. Press Ctrl + Alt + F2 and you will be able to log in. Once you have logged in navigate to wherever you downloaded your driver to and make the driver executable by typing (note your driver might be called something slightly different):
chmod a+x NVIDIA-Linux-x86-169.09-pkg1.run
You can now install the driver by typing:
./NVIDIA-Linux-x86-169.09-pkg1.run
Run through the installation, answering any of the questions. When the installation is complete you can start your xserver again. To start your xserver in KDE type:
sudo /etc/init.d/kdm start
Or if you want to use Gnome desktop type:
sudo /etc/init.d/gdm start
Your GUI should now start up again with the latest driver for your graphics card installed.

Tuesday, 5 February 2008

Storing results of commands in an array

If you want to create an array of directories using bash you might try:

directories=`ls`

However, this will create a variable containing each file separated by spaces like this:
adm agentx cache games lib lock log mail opt run spool tmp X11R6 yp
To place each item into its own element you simply need to add some brackets:

directories=(`ls`)

You can test this has worked with a simple loop:

directories=(`ls /var`)
for (( i=0; i<${#directories[@]}; i+=1 )); do echo ${directories[${i}]} ; done
output:
adm
agentx
cache
games
lib
lock
log
mail
opt
run
spool
tmp
X11R6
yp

Sunday, 3 February 2008

Searching the apt-get repositories

If you need to install a package via apt-get but you don’t know it’s exact name there is a simple way of searching the repository to find it.

If, for instance you wanted to install Kopete you would search the repository like so:
apt-cache search kopete
This will return a list of programs that looks like this:
kdeartwork-emoticons - emoticon collections for KDE chat clients
kdenetwork-dev - development files for the KDE network module
kopete - instant messenger for KDE
ichthux-emoticons - Christian emoticons for Kopete
kmess - Instant messenger to use MSN on KDE
kopete-otr - Off-The-Record encryption for Kopete
kopete-plugin-desklist - Kopete plugin which displays online contacts on desktop
kopete-kde4 - instant messenger for KDE 4
kdenetwork-dev-kde4 - development files for the KDE 4 network module
kdeartwork-emoticons-kde4 - emoticon collections for KDE4 chat clients
You can see from this that the package you need is “kopete” or “kopete-kde4″ if you’re running KDE 4.

You can then go on to install the package with:
sudo apt-install kopete