Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Friday, 17 August 2012

Choosing a new file backup "system"

"Hey you're a computer person.  How you backup your stuff?"

"I hate to admit it, but less often and in different ways than I should."
Yep, it's time to get going with rsync, or a package that uses it.  (This is a Linux blog, but Windows and Mac users will find the following useful as well).

In the past, I've duplicated important data to a secondary hard drive on occasion.  At some point, I've burned some of it to cd.  There are problems with this.

For those of you who aren't well-versed in data storage and backup theory:

Considerations:

  • backups should be done regularly
  • backups must be verifiable (a backup that isn't working is useless)
  • backups should probably be done automatically (or else we forget to to them and and cry in our pillows later)
  • backups should be done on a reliable medium (CDs/DVDs may not suffice, neither will the USB stick if you let your cat use it as his toy)
  • backups that save new stuff since the last backup are ok (aka differential backup), but occasionally should save the whole thing too
  • for the paranoid, back up on two different mediums in different locations (if you copy stuff from your hard drive to another hard drive, CD and USB stick and then house catches fire, you're still screwed)
For home use, you may want to consider tradeoffs for some circumstances.  You may accept some risk for the sake of convenience.  For example,
  • If you don't have much that's important, then maybe it's not worth effort of backing up off-site.  Acknowledge that the risk of the hard drive or CD dying is much higher than the computer and disc catching fire.
  • Using CDs for backup can be risky.  CDs/DVDs burned at home have a limited shelf life. Some authorities on the matter estimate 5-10 years before it disintegrates or data loss happens, but a crappy lesser-known branded disc will likely be even more susceptible to failure.  Sometimes you'll get lucky and it will last a long time, but you never know until you need to use it a few years down the road.  If you burn to disc, caveat emptor.
Don't worry, pressed discs from a manufacturer are different, they last a lot longer.  They're not made via the same methods you use at home.

Cloud/Internet storage raises other concerns a lot of people don't realize.  Whether you send something in email to yourself, save something in skydrive, google documents, or elsewhere, or use dropbox, beware the fine print and risk.

- you're trusting another entity to "keep it safe" for you
- some items are illegal to store (movies, music, etc.)
- some items you really shouldn't store (really private info)
- storage can cross international boundaries, which may be subject to other laws.  As a Canadian, I have to give this more consideration as much of my online presence resides on servers in the United States. 

Even if it doesn't cross boundaries, there may be other circumstances you don't expect (ie. a Slashdot user noted that Dropbox will unencrypt your data and hand it over to the law, possibly without a warrant.)

Even some cloud storage claims they encrypt (privatize) the contents so no one can see them, however, consider these places also scan the content to check for illegal content.  Think about that for a minute.  That means the data is private to the general public, but not to thousands that work at that company.  And if you picked a poor password, or if the company that has a security flaw that leaves them open to hacking, your stuff REALLY isn't private at all.  If you're considering internet/cloud, beware the risk (and make sure you pick a good password).

My recommendations for the average schmo:
  • copy exceptionally important information to a trusted family member, or to media you keep in a safe deposit box (A friend of mine uses Quickbooks, as does his Dad.  They swap backup files to each others' computers via USB stick on occasion.)
  • use tape media when possible (tape is the gold standard for industry - it's slow but resilient).  Remember still that tape is susceptible to magnetic fields, so keep it safe from anything that generates a field.
  • use hard drives over CDs.  If buying a hard drive, do your research first, some models for certain years are notorious for kicking the bucket way too early.  If buying CDs, buy brand-name, not some weird crap at the dollar store.  Actually, stay away from the dollar store for media unless you don't mind it being potentially temporary.  Ask yourself how the dollar store got it so cheap in the first place... that's right, either the factory doesn't have high standards, or the some batches frm a better-known company don't meet quality standards.
  •  use USB sticks if you're not a schmuck who always looses stuff.  Buy one that you keep attached to something, like your keys.  Buy one that has an integrated cap that you can't lose (protect the plug end when possible).  And for the Love of God, NEVER wiggle a USB stick when inserting it or pulling it out.  Usually the side that's labelled with a light or the USB log is mean to be up when you insert the thing.  If you break the plastic around the four metal prongs, you can easily end up bending the prongs and  shorting your computer.
The USB sticks that have "U3", "protection" or some advertised variant on them technically do protect the average person from finding your lost stick and accessing the contents.  However, they're hackable to anyone who knows what they're doing, and very annoying otherwise (unnecessary software installed on every computer it touches).  Some are so annoying they actually don't work on a machine you don't have administrative privileges to (i.e. your work computer).  So it's up to you, but I think they're crap.   Then again, I don't ever put anything too personal on my USB drive.  Nah, they're still crap.

  • Store less important stuff in the cloud.  I use Google Docs for some stuff, but it's for stuff I might need to work on elsewhere, but isn't too personal.  The most personal thing I had on there is a documentation about an apartment I used to have (I had to initiate terminating the rental contract.)  Since I was in the middle of moving, I decided creating that document on Google Docs was probably more secure than moving my computer to a new place and having it dropped, etc.  I needed the document accessible because I needed it quickly available in case of a dispute.  If it's moderate importance, store a copy on your computer back home every now and then.
  • I've only known one person to have one of the newer all-in-one hands-off backup systems.  It's basically a box you plug into you computer, and comes with some software.  She used it to back up her karaoke files, but then it seemed to die.  I'm not sure if she doesn't know how to use it, of if it actually died.  This system may be an option, but as I am unfamiliar with them and don't even know what brand/model she had, I have no opinion on their usefulness.

With any backup system, realize that it's not infallible.  Maybe we'll happen to pick a bad hard drive or bad DVD despite our research.  What you have to decide is how much effort you're going to put in to migitate any risks of the medium or methods you choose.




New Methods

I need to get serious about my methods, but I'm still a Canadian with a cheap Ukrainian background, so I won't be running out to buy a tape backup system.   Up to now, I'm been using what I call the PUP method (procrastinate until panic).

Current methods:
  • burned some music a few years ago to DVD
  • burned some old coursework I like to think I should keep to DVD (but haven't touched since then)
  • manually copied a personal 700+ entry LibreOfflice/OpenOffice database to my secondary hard drive a few months ago
  • some things I like to keep readily accessible are in the cloud.  None of it is too personal.
Incidentally, the database is what really precipitated this blog post.   I went to use it the other day and go the message 
"The connection to the data source "" could not be established. The driver class " could not be loaded".
SQL Status: HY000
The connection to the external data source could not be established. No SDBC driver was found for the given URL. 

It turned out the .odb database was corrupt; I had to use a tool to extract my table from the corrupt file.  I had to rebuild my SQL queries and forms, but at least I had an old backup for that.  If the tool hadn't worked, I would have lost 1/4 of my data table.


New methods:
  • move and organize files to one hard drive with a good file folder and tagging system
  • set up rsync or a rsync-based program to use my secondary hard drive to automatically back up those files
  • generate occasional reports that are emailed to me automatically so I know it's working well.
  • maybe burn some stuff on DVD and store it off-site somewhere for a duplicate backup
Next post will be on delving into rsync and possibly ready-to-go programs such as GAdmin-Rync, Grsync, luckyBackup, Unison, Back-In-Time, File Backup Manager, Deja Dup, Nepomuk etc.


Wednesday, 9 June 2010

Sysadmin: an exercise in being functionally lazy.

I'm sitting on my couch, working really hard on my laptop. Everything is perfectly arranged around me while I study.

The linux box sitting 15 feet away from me has an internet radio station playing on amarok. The next song comes on, and it's louder than the other songs.

I really don't want to get up.

Surely some linux user has had this grave problem before. I was about to do a google search for an app on my Windows 7 laptop that would do it, then i realized I already had Putty set up to connect to my pc. All I need is the command for the command line.

To reduce your volume 15%
aumix -v-15
Too much? Increase 5%
aumix -v+15
(You may need to install the aumix package to use the commands above)
apt-get install aumix


I'm sure there's many other ways to pull this off (it is Linux, after all). Feel free to share if you have one!

Monday, 25 January 2010

Combine multiple images or multiple single-page PDFs into a multipage PDF

This method requires installing a (great) image-manipulation package, and using the command line, but it's very simple - suitable for someone new to using a command line.

If you do a lot of work with images, or have to do a lot of repetitive work or batch processing, I really recommend looking into ImageMagick. You can do things like make thumbnails of a certain size out of a directory, with just a few words.

Get Imagemagick if you don't have it already.
Open a commmand prompt and install ImageMagick:
apt-get install imagemagick
Now to combine your images into a multi-page PDF:
Go to the directory where are your images are.
cd /home/computername/pics
Convert the JPG files to PDF:
convert *.jpg foo.pdf
It will create a multi-page PDF, named foo.pdf in the directory you're in. Just make up whatever name you like for "foo". The pages will be arranged by alphabetical order (the filename). This method will use ALL of the jpg's in the directory. If you aren't familiar with using wildcards (*, ?) or are unfamiliar with command line, I recommend making a directory that only has the files you want to use, and put it in your /home directory so it's easy to find. If you want to only include files that differ by a letter, you can use something like
convert sample?.jpg samplepkg.pdf
...which will only place files like sample1.jpg, sample2.jpg, sample3.jpg in the pdf.

I have noticed the file size gets pretty large using this method. There are probably some command line options to set to manipulate this. Something that does make it smaller is using a graphics program like Gimp, and using the "print" option to "print to" a pdf. Then you can use the command line to combine the single page pdf's into a multipage single pdf.
convert *.pdf multi.pdf
"*" means everything, so keep in mind it will use every pdf in that directory to make a new one... even if it's multipage!

Thursday, 7 January 2010

Common Ubuntu Keyboard Shortcuts

I've finally started on my Network Technology course, where I will be doing and MCSE, CCNA, and possibly prepping for a Linux+, all in the next eight months. Stay tuned for some more interesting tidbits on the blog as I have time.

On another note, I am aware of some OS keystroke shortcuts, but had the urge to use more. Why don't I know the one for Show Desktop, for instance (it's Ctrl-Alt-D). You can also map keyboard shortcuts, which is really handy if you want to use something like the Windows key.

  • Win+E - Shows all workspaces in a nifty way and lets you switch between workspaces easily.
  • Alt+Ctrl+Left/Right Arrow – Move to Workspace on Left/Right
  • Alt+Ctrl+Shift+Left/Right Arrow – Move current window to another workspace
  • Alt + Shift+ Up Arrow – This initiates a cool looking window switcher interface with which you can switch between windows using Arrow keys while holding Alt + Shift
  • Alt+F9/F10 – Minimize/ Maximize current window
  • Alt+F5 – UnMaximizes Current Window
  • Alt+F7 – This shortcut activates the move window option that lets you move current window using arrow keys. You can even move window to other workspace, try moving it to extreme right.
  • Alt+F8 – Resize current window with arrow keys
  • Ctrl + Alt + D – Show Desktop/ Restore open windows if show desktop used earlier
  • Alt+Shift+Tab – Switch Windows in Reverse Direction as done using Alt+Tab
  • Shift+Ctrl+N – Create New Folder, Very useful shortcut
  • Alt + Enter – Show properties of a selected file/folder without requiring to right click on it and select Properties.
  • Ctrl + 1/2 – Change folder view to icon/list.
  • Ctrl + W – close current Nautilus Window
  • Ctrl + Shift + W – close all open Nautilus Windows
  • Ctrl+T – Open a new tab in Nautilus
  • Alt + Up/Down Arrow – Move to Parent Folder/ Selected folder
  • Alt + Left/Right Arrow – Move Back/forward in Nautilus
  • Alt + Home – Move directly to your Home Folder
  • F9 – Toggle display of Nautilus Sidepane
  • Ctrl + H – Toggle Display of hidden files and folders
  • Ctrl + Alt + L - Quick shortcut to Lock Screen if you need to be away from your desktop for few moments and don’t want others to see your desktop.
  • Alt + F1 – Open Applications Menu
  • Alt + F2 – Open the Run Application dialog Box
  • Win + Mousewheel – Zoom in / Zoom out Desktop. This one’s pretty useful if you are having a wireless keyboard/mouse.
(shamelessly stolen from TechnoTraits... if you found these of use, be a sport and visit them!)

Wednesday, 16 December 2009

Fonts Not Displaying Properly on Web Pages

I noticed one day that some webpages were a little difficult to read as the (sans-serif) font it used looked borked, for some reason. The first time I noticed this, I viewed the source, but didn't find a font declaration in that page. The most recent time I looked at a sample, I found this
<FONT face="sans-serif,helvetica,arial">
I haven't done much work with CSS, so I wasn't aware that order matters when declaring a font to use with CSS. If the first font in a list exists on your system, it will use that one first.

There are several font declarations in the HTML source, but for the main text, the results are:

It's just strange. Off. It's lacking some sort of smoothness. The vertical alignment of each letter also seems to be slightly different. Kerning is yucky. Though it is a sans serif (screen) font, I just don't find it very readable or pleasing to the eye.

FYI:
  • sans serif (clean) fonts are intended for reading on screen
  • serif fonts (fonts with little flicks or marks on the corners) are intended for printed text
The paradigm is that legibility is best when fonts are used this way.

What's funny is this situation appeared on a The Linux Documentation Project page. A Linux page viewed in Linux looks funny.

When typing an Openoffice document, all fonts appear, and are as expected (from screenshot:).


...despite sans-serif having no kerning and ugly tracking.

However, bump that font size down from 24pt to 10pt, and Helvetica is ugly! What the hell happened to those e's and a's?

("Font Darwin Award" once again goes to sans-serif, for its display of horrid kerning and tracking. If it wasn't obvious before, it sure is now.)

Theoretically, since sans-serif exists on my system, that should be the one being used in a web page (because it's first in the web page's font list). However, the evidence suggests it's actually using Helvetica. Why is Helvetica on my machine so ugly once it goes below 14pt or 12pt? I don't know. Still investigating. My monitor is a few years old, and my graphics is a good graphics card less than a year old, so I doubt those are the issue. Even so, why is this an issue with Helvetica, but not with the other fonts?

The only solution I can think of so far is to uninstall Helvetica. The print nerd in me really doesn't want to. If you really want to nerd-out, this is a great guide to fonts on Linux.

Please let me know if you figure this one out!

Sunday, 9 August 2009

pdflush process isn't what you think it is

Yeah. Please don't try to kill the pdflush process.

Having started as a Windows user, it would really, really irk me that a whole bunch of (unnecessary) processes would be running. I would annihilate them at every opportunity, but at least I'm (usually) smart enough to look up what it is first.

Having moved to linux, there's a whole new ballgame of processes to look up.

Friday, 24 April 2009

How to (Quickly) Check What Version of Ubuntu You Have

Applications --> Accessories --> Terminal. In the box type the following command:-

lsb_release -a

Sunday, 1 March 2009

Share Mouse and Keyboard with Software

Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It's intended for users with multiple computers on their desk since each system uses its own monitor(s).
I'm currently using a KVM switch (and one monitor), but it's nice to know there is a multi-monitor open software solution out there!

Monday, 5 January 2009

The Command Command

man -k list directory
Lists commands and a very brief description of each. Lots of enlightening stuff here.

Tuesday, 4 November 2008

I Like Toys

I finally got a digital camera. I'm not experienced with them at all on any system, so when it came time to plugging it in to my computer, I wasn't sure of what I was doing.

I plugged the sucker in, and I expected a little USB-type drive would pop up on my desktop, but that did not happen.

Searching for a solution was kind of a pain because lots of ads for my camera kept popping up. Samsung doesn't exactly give directions for linux, either.

A little more searching finally revealed this page.

You have to turn the camera on after you plug it in to the computer. The page also warns to turn it off before unplugging it. By this, I would assume the USB device doesn't draw power from the computer via the USB connection, but it draws power from the camera's batteries.

A green light came on on the camera when connected. The screen momentarily asked me to choose between "computer" and "printer", so I chose... computer. The screen then turned black, but the light stayed on. At this point, a device appeared on my desktop, and I was able to sift through the directories in there like a regular USB flash drive.

Hope that solves a "what now" scenario for some of you camera/linux newbies.

What camera did I pick up? A Samsung S760 at "Wally World". 7.2megapixel, 3x optical zoom, takes SD cards only (not SDHC). Set me back $87 (November 01, 2008). Yes, I got the pink one. I'm generally anti-pink, but in my defense, I think it's less likely to get stolen and less likely to be mistaken for someone else's.

Pretty decent pictures, especially if you stablile the camera well when snapping photos. I used Digital Image Stabilization mode to take a few night shots outside my window. Best sample:


You're looking down Broadway Ave towards Main in Winnipeg, MB. The large white lit-up building is the Hotel Fort Garry.

Thursday, 25 September 2008

BSOD on Linux

Yes, you can get the Blue Screen of Death in Linux. Too funny.
xscreensaver
is a package you can find in your repository. It has all sorts of screensavers, including popular OS error screens. Install via Synaptic Package Manager, Adept, or what have you.


Good for confusing the hell out of a roommate, friend, or spouse, though I really don't recommend messing around with the desktop environment settings of a person who you may want to continue relations with.

For a temporary trick, try this Flash trick. The ESC key exits full screen mode in Flash.

Saturday, 13 September 2008

tar switches for command line

tar -xzvf /path/to/your/file.tar.gz
xkcd? xfce? No. xzvf.

I'm sorry, that's a really bad nerd joke. I'll bet the nerds didn't even laugh.

Flash player doesn't install in Firefox

Flash wasn't working for me in Firefox. At one point, I had installed several flash players via Symantic or Adept, until learning I should only install flashplayer-nonfree. I removed the other ones, but still no go. I tried downloading the package from Adobe manually, and installing via the command line, but got this error:
Please enter the installation path of the Mozilla, Netscape,
or Opera browser (i.e., /usr/lib/mozilla): /usr/bin/firefox

WARNING: /usr/bin/firefox is not a directory.
Here are the tricks to fix it:
  • it seems the Adobe installer wants the actual numbered version of the firefox directory. "whereis firefox" didn't help me in this respect (as suggested on help forums). I ended up using /usr/lib/firefox-3.0.1 Yours might be slightly different. Why Adobe couldn't have indicated this in the installer... I don't know. Twits.
  • when testing out whether flash works on something like YouTube, make sure you don't have something like the "NoScript" add-on preventing anything you may need. (D'oh!) I had to allow both youtube.com and ytimg.com in NoScript.
... that brings up the question whether flash was actually working all along and my NoScript was thwarting all my efforts. Oh, probably.

Thursday, 24 July 2008

Viewing your Drives

sudo fdisk -l
(For posterity.) I forget this command.

And. Well. Forgetting this command is a little more understandable (I use it to mount my NTFS drive):
sudo mount /dev/hdb1 /media/kat120data/ -t ntfs -o nls=utf8,umask=0222
(all one line)

For those of you who don't know, drives connected with an IDE cable are listed as hda, hdb, (etc.) Their partitions have a number... for example, hda1, hda2, hda3... Drives that are connected via USB (external) or SATA (internal) connectors are labeled with 's', for example: sda1. There are a lot more filesystems than this, and they require different commands for mounting properly.

Be warned that NTFS drives (formatted under Windows NT or Windows 2000) don't necessarily have reliable write access under Linux. They're working on it. You can install some packages to mess around with it. Hard drives formatted with FAT32 (Windows XP, Windows 98, Windows 95...) have reliable read/write access when mounted in Linux.

Because of ext3 (Linux filesystem) benefits, I was really wound up to format my new USB external hard drive in ext3. Upon opening the box and reading the documentation, it is already formatted in FAT32. I've decided to leave it this way because I want my friends to be able to easily read the data off my drive (in case I cart it over to their place). Windows and ext3 don't intrinsically get along.

Most of us have only heard about FAT32 and NTFS, but the amount of computer filesystems is huge.

Monday, 7 April 2008

Worms & WINE Are Not as Expected

Today I came across a web page with a download for the old computer game Worms 2. I recall playing this and Worms: Armageddon with my fellow residence friends when I was in University (affectionately called "rezbians"). I wondered if it could run on Linux. I know there is a web page somewhere which tells you such things.

I typed "worms wine" into Google before thinking. I got unexpected results which should (?) have been expected.

Sunday, 20 January 2008

Lost Sound when Plugging in USB flash

I was playing an .avi in kaffeine, and at the same time I plugged in a 512MB USB flash drive. Immediately I lost sound in Kaffeine, though video was still playing. I check Youtube via Firefox, same thing.

I used to have a problem in Amarok where if Amarok crashed, it would mute the sound without my noticing. Thankfully I remembered to check this in Kaffeine, but that was not the problem.

I don't mess with the sound settings often, so I had a fun time trying to find them (turns out they're not in your system or settings menu... try looking for KMix in the Multimedia menu instead.)

I log on to the freenode IRC channel #kubuntu, and a couple nice folks there had some suggestions for me.

I was told to pay special attention to KMix lines: master, master mono, PCM. These were all fine (at or near the top).

(You can also open alsamixer via the command line)
alsamixer
I was then advised to restart ALSA.
sudo /etc/init.d/alsa-utils restart
This did not work. I tried closing all my programs which might be using sound, and running the command again. This did not work either.

I ran the command, and then rebooted. This works! Now I have my sound back.

Tuesday, 23 October 2007

Installing and Switching Between Extra Desktops / Window Managers

You don't have to commit to one Desktop style. You can install GNOME, KDE, XFCE (among others), and just switch between them.

  • GNOME is the desktop used in Ubuntu.
  • KDE is the desktop used in Kubuntu.
  • Xfce is the desktop used in Xubuntu.

To switch between the desktops, log out. When you log back in, click the "session" button and select which window manager you want to use. Easy as pie.

To install, you can use Synaptic Package manager, or apt-get (on the command line). However, these methods don't keep track of dependencies, so it's recommended you use aptitude (on the command line) instead:

sudo aptitude update
sudo aptitude install kubuntu-desktop
sudo aptitude install xubuntu-desktop
Link in title as always, or here.

Monday, 3 September 2007

Lost Running Applications / Programs in Toolbar

A while ago, I was adding and removing applications from the panel, and the spacing between them got all screwy. Next thing I know my list of running applications is gone.

Couldn't find it for the life of me. Gave up trying to find an answer, said "screw it", and just started using alt+tab to switch between running programs. Still annoying though.

Incidentally, I discovered if you move your mouse cursor over the title (top) of a window that's open, using mouse's scroll wheel will make you switch between the last two windows.

Anyway...

Happened to be on irc.freenode.net #kubuntu ... and someone there posted a similar problem. To get back your application list in your toolbar / panel:
  1. right-click on toolbar in an empty spot
  2. click "Add Applet to Panel" (this is where you say AHHHHHH!)
  3. click Taskbar and OK.

Import Thunderbird Mail into Kmail

I wanted to import my messages from Thunderbird into Kmail, so I could use Kontact as my entire personal information tool. I could not find a tool anywhere in Kmail / Kontact (or even just right in Kmail) to import mail from another program. After Googling it, I found it should be in Tools -> Import Messages. The odd thing is I didn't have that menu option. Another thing to try is using a tool mozilla2kmail.pl, but that didn't work for me.

Cliff's Notes:
  • make sure kmailcvt is installed. Use Synaptic Package Manager to get it.
  • then in Kontact/Kmail use File -> Import Messages to import messages from Thunderbird.

Story:
Kmail 1.9.1 using KDE 3.5.2

Found some wonky directions here, but that seemed too complicated.

I looked up the Kmail (via the menus in Kontact/Kmail). The help file seemed to be out of date, web address gets rerouted here.

A bit of a beef I have with the Kontact web site is that they don't give you the current revision of the entire package, nor the current revision of the components of the package. I looked at FAQ of the Kontact page. I didn't see a link to an IRC channel, but I tried out
irc.freenode.net #kontact
The channel does exist, but appears to be a small developer's channel. No one seemed to be awake.

The aforementioned mozilla2kmail.pl script had to be run with
chmod +x mozilla2kmail.pl
sudo ./mozilla2kmail.pl
which gave an error that "./home/kat/Mail is not a directory."
To get help you need to type
./mozilla2kmail.pl --help
which is different than indicated ("mozilla2kmail --help")! This command gives me
"You need to install the perl-doc package to use this program."
I install perl-doc using Synaptic Package Manager, but I still get ". /home/kat/Mail is not a directory." after doing a "sudo ./mozilla2kmail.pl"

Did more searching and came up with the Cliff's Notes solution, which works. The only stickler is that when the import runs, it doesn't make it obvious what it wants you to open. I selected the entire mail folder (/home/kat/.thunderbird/fzcc2crp.default/Mail/) which had two folders in it: a "Local Folder" and a "pop.gmail.com folder." This seems to work.

Sunday, 29 July 2007

Installing Microsoft Truetype fonts on Ubuntu

"You can install the MS core fonts by installing the msttcorefonts package. To do this, enable the “Universe” component of the repositories. This is done by default in Feisty. After you do that, use the following command from the command line:
$sudo apt-get install msttcorefonts
This will give you the core fonts, but if there are other TrueType fonts that you want installed, it is as easy as copying the font files to the ~/.fonts/ directory.

After installing new fonts, you will have to log out and log in again to be able to see and use the new fonts. If you want to avoid this, you can regenerate the fonts cache by issuing the following command:"
$sudo fc-cache -fv

Thanks to Carthik's Ubuntu blog.