Saturday, 26 July 2008

Navigating folders from the command line

If you've followed the posts on this blog for a while, you should be reasonably comfortable using the command line to install software, edit configuration files and so on. You should also be aware of the layout of the Linux filesystem. However, you may not be aware of how to navigate it without using a graphical file manager such as Nautilus or Konqueror. So in this post I'm going to go through basic commands for navigating from the command line.

First of all is the cd command. This is short for "change directory". The default location for you to start is in your home directory, and entering the following:

will take you to your home directory. You can also use the ~ character (known as a tilde) as shorthand for your home directory, which is useful if referring to your home directory from elsewhere. So, entering the following:
cd ~

will give the same results as the previous command.

You can also navigate up one directory as follows:
cd ..

And can go back to the previous directory using this command:
cd -

These commands can be used as part of longer paths. For instance, say you are currently in /var/www but want to go to a folder called Music in your home folder. You can go there with this command:
cd /home/username/Music

Or you can use this:
cd ~/Music

Now, say you want to go from there to another folder in your home directory called Pictures. You can enter this:
cd ../Pictures

Then, to head back to the Music folder, you can enter the following:
cd -

And to head to the root of the filesystem, just enter the following:
cd /

Now, how can you see where you are? Easy, just enter the pwd command (short for Print Working Directory). Here I'm in the Desktop directory:

Got that? I recommend you spend a little time getting comfortable with these commands as they are the first building blocks in becoming proficient at the command line. Next time I'll go into creating and deleting files and folders.

Sunday, 20 July 2008

Recreating my Ubuntu desktop

I've been asked how to recreate the desktop I showed in the previous post in Ubuntu. For those who haven't seen it, here it is:

OK, first of all there's a number of applications you need (I'm assuming you're working from a fresh install). So run the following command:
sudo apt-get install avant-window-navigator awn-manager compizconfig-settings-manager emerald gnome-do gnome-do-plugins
Strictly speaking, Gnome Do isn't required as it doesn't contribute to the appearance, but it's a very handy application launcher.

Once these are installed, you'll need to remove the bottom panel. Move any applets you want to keep up to the top panel, then right-click on the bottom panel and select Remove This Panel. To set Avant Window Navigator to run when you start up, go to System>Preferences>Sessions and select Add. Then enter Avant Window Navigator as the name, and /usr/bin/avant-window-navigator as the command. You can put anything you like for the description (I put "Mac OS X-style dock bar").

Now to grab the packages you need:
  1. Genesis Emerald Theme
  2. Blue-Joy GTK Theme
  3. Oxygen Refit 2 Icon Theme
  4. Peace Wallpaper
Now open System>Preferences>Appearance. From the Theme tab, click on Install. You'll be able to browse your filesystem for the theme packages you just downloaded. Use this method to install the Blue-Joy GTK theme and the Oxygen Refit 2 icon theme. For the background, go to the Background tab, click on Add, and select it using the file browser. You might want to copy it to your/usr/share/backgrounds so all users can have it - this can be done with the following command:
sudo cp (insert name of image here) /usr/share/backgrounds

Finally, to install the Emerald theme. Go to System>Preferences>Emerald Theme Manager. Click on Import, select the theme package, and click on Open. You should then be able to select the theme package from the list of those installed.

However, it won't have any immediate effect as Emerald isn't running. To start it up, enter the following command at the terminal:
emerald --replace

To make Emerald always be the default window decorator, open CompizConfig Settings Manager and look for Window Decorator under Effects. Check the box, then click on the icon to adjust the settings. Replace whatever is in the Command box with emerald --replace.

If you now log out, restart your X window server using the Options menu from the login page, then log back in, Emerald and AWN should be running straight away. You can then add whatever launchers you want, but by default AWN only has the launcher applet. If you want to add Ubuntu Tweak so you can add more applets to AWN, please refer to my previous post.

If you're interested in recreating the dock bar I've got, here it is from left to right:
  1. File Browser applet
  2. Firefox launcher
  3. Exaile music player launcher
  4. VLC media player launcher
  5. GIMP launcher
  6. Evolution launcher
  7. Pidgin launcher
  8. Jokosher audio editor launcher
  9. Kino launcher
  10. F-Spot launcher
  11. Skype launcher
  12. launcher (not the applet, I couldn't get that to work)
  13. XChat IRC client launcher
  14. Time Vault launcher
  15. Ubuntu Tweak launcher
  16. Gnome Terminal launcher
  17. Showdesktop applet
  18. Stacks Trasher applet
I personally really like this desktop. I'm normally more of a KDE guy (I have a separate Kubuntu install on another computer, while this computer is dual-booting Vista and Ubuntu), but I really enjoy working in this kind of environment. I've added two more virtual desktops so as to get the cube effect, and the whole thing looks amazing.

One problem with using this theme is that a lot of things are black that aren't normally (such as the paper in OpenOffice!) and I haven't yet found a way round this, so this might be a problem. I'm hoping the theme's author will be able to resolve this.

Saturday, 19 July 2008

Using Ubuntu Tweak to get third-party apps

The likes of Compiz and Avant Window Navigator are great for improving the appearance and usability of your Ubuntu desktop, but out of the box many of them don't include the latest and greatest features. For instance, Avant Window Navigator is available from the Ubuntu repositories in Hardy, but there's no applets available from there other than the launcher applet. This is a shame as there are a lot of applets which improve the functionality of AWN no end. The same applies for Compiz - how can you get new new plugins such as Cube Deformation (allowing you to change the cube to a cylinder or sphere)?

Now, one way is to add the respective PPA (Personal Package Archive) on Launchpad to your /etc/apt/sources.list. But there's an easier way - Ubuntu Tweak. This incredibly useful application allows you to quickly and easily add these third party repositories using a graphical interface. Normally I'm a strong advocate of the command line in this context, but we've gone through adding additional repositories in the past, and in this case I feel Ubuntu Tweak is the easier way to do it.

To get started, first download and install the package as usual. Run it as normal and you will come to a screen like this:

Select Applications, then Third Party Software Sources. This will take you to a list of the software that you can use Ubuntu Tweak to keep up to date with. You'll need to click on Unlock and enter your password before you can add anything (this is because Ubuntu Tweak needs root access to add the new repositories).
Now you can add the repositories for whatever apps you wish to keep up to date with, whether that's the latest versions of Google Gadgets, AWN, Compiz, Wine or whatever takes your fancy. Once you've selected what you want, click Refresh. The new repositories will be added and Update Manager will open - you'll need to enter your password again and an apt-get update will run automatically.
Now that you have the new new repositories added, you can get the newest versions of the apps you've chosen just by running the following:
sudo apt-get update
sudo apt-get upgrade

However, there are a few things that aren't included by default, and additional applets for AWN are one of them. To add these, once you've added the AWN repository from Ubuntu Tweak, just run the following command:
sudo apt-get install awn-applets-c-core awn-applets-c-extras awn-applets-python-core awn-applets-python-extras

This will install the applets available from the repository. You'll no doubt find that Avant Window Navigator becomes enormously more powerful once you add these additional applets. You can do a lot with it once you get used to it.

Ubuntu Tweak can be incredibly handy for non-technical users. It acts as a great one-stop control panel, and allows you to get some of the newest and most impressive goodies available for Linux. But unlike Automatix, it's safe to use and won't destabilise your system. For demonstration purposes, here's the Sphere effect. It's under Cube Reflection and Deformation in CompizConfig Settings Manager.

Pretty impressive, huh? Hope you have fun with Ubuntu Tweak!

Wednesday, 9 July 2008

Backing up your system with Remastersys

I've previously mentioned how to set up /home on a separate partition to help ensure that your data is safe if anything goes wrong with your Ubuntu install. However, we all like to add a few extra applications and other things, and if anything goes wrong, it will take you a long time to reinstall these. How can you make this easier?
Simple, use Remastersys. This incredibly handy utility allows you to create your own customised install CD based on your Ubuntu or Linux Mint installation. It's actually used to create a few Ubuntu derivatives, and you can quite easily use it for this purpose yourself if you so wish, as you can use it to create a distributable copy. I now have a DVD based on my Kubuntu install so I can easily reinstall it if anything goes wrong, and it includes all the multimedia codecs so everything works out of the box. And it's extremely easy to use.
So, how do you install it? It's not in the Ubuntu repositories, but there is a Remastersys repository which you can add. Just enter the following:
sudo vim /etc/apt/sources.list

As always, you can use nano or another editor if you prefer. Now add the following lines:
# Remastersys
deb remastersys/

Now run the following commands to install it:
sudo apt-get update
sudo apt-get install remastersys

Before you run it, you may want to change some of the settings. These are in a text file at /etc/remastersys.conf. This file is very straightforward to use, and everything is well signposted - you can easily change the name of the customised CD by editing this file.
Now, when you run Remastersys, it will create an ISO image based on your current install, so for instance if you're running Ubuntu but have added the Kubuntu desktop, it will be on the CD as well.
Before you run it, close down every other application you are running as they can affect the build. There are two ways you can run it. To back up everything, including user's directories, run the following:
sudo remastersys backup

If you're planning to distribute copies of this to other people, for instance if you are using Remastersys to create your own distro, you won't want to run this. Instead, run this command to create a distributable version which you can give to others:
sudo remastersys dist

The process can take a while, especially if you have a lot of applications installed. Be aware that ISO images of over 2GB can have trouble booting, however don't worry if your system takes up more space than that as it's compressed significantly when the ISO image is built (the standard Ubuntu install takes up around 2GB when installed, but around 700MB as an ISO). Please also note that an image larger than 700MB will need to be burned to a DVD.
Once the process has finished, if you go to the /home directory, you'll notice an extra user directory has been added - Remastersys. Go into this directory, and there's another Remastersys folder inside that. Inside you'll find your new ISO image, which you can move to your own home directory, along with an m5d checksum.
Now that's done, you can clear up the build directory. This is easy, just enter the following:
sudo remastersys clean

Make sure you've moved the ISO to your own directory before you do this. Now you can use whichever CD-burning tool you prefer to burn the disc to a CD or DVD, and you now have your own customised Ubuntu!
There are endless uses for this. I've been experimenting with creating my own distribution using this method - so far it's pretty poor, but it's educational. With a distributable copy of your install and with your /home directory on a separate partition, it's easy to restore your system in case anything goes wrong. You can create a copy of your install and run it in VirtualBox so that you can use that as a test bed for any changes you might want to make. And it can be handy to have with you as it means you can boot any computer into your own familiar desktop environment, with your own favourite applications, without having to install a thing. I urge you to try it!