Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Sunday, October 4, 2009

Reduce image file size with GIMP

This is an easy way to reduce image file size. What you have to do is to convert the image mode from RGB to Indexed colours.

In GIMP, click on Image > Mode > Indexed.

Finally, change the "Maximum number of colors" property value from 256 to 16 or 32 as shown in Figure 1.

Figure 1: Indexed Color Conversion

Saturday, October 3, 2009

How to upgrade Ubuntu 9.04 to 9.10

To upgrade Ubuntu 9.04 to 9.10 is easy.

First, press Alt+F2 to get the "Run Application" (Figure 1). Type in
update-manager -d

and, click Run. 
Figure 1: Run Application
Finally, click Upgrade on "Update Manager" (Figure 2).
Figure 2: Update Manager


Wednesday, September 30, 2009

How to change Shiretoko codename to Firefox

Shiretoko is the development codename for Firefox 3.5.x.

To change the User-Agent identification to Firefox,

  1. Enter about:config in the address bar.

  2. Enter general.useragent.extra.firefox in the field at the top.

  3. Change its value from Shiretoko/3.5.4pre to Firefox.

Friday, September 18, 2009

LaTeX editor with live preview pane for Ubuntu/Linux

Gummi
Gummi is a lightweight LaTeX editor written in Python/GTK+ released as open-source software under a dual MIT/Beerware license, and was written by a BSc student of Artificial Intelligence at the University of Amsterdam, Alexander van der Mey.

The main feature of Gummi is that the Preview Pane will update as you are typing. In my opinion, this feature is good if you are learning LaTeX.

Give Gummi a try, and tell me your opinion.

Click here to download.

Thursday, September 17, 2009

Resize image using Imagemagick

Imagemagick is a powerful image manipulation program. This tutorial is about resizing image with Imagemagick.

Resize an image to 500px width.
mogrify -resize 500 image.png

Resize an image to 500x300, with aspect ratio preserved.
mogrify -resize 500x300 image.png

Force resize an image to 500x300.
mogrify -resize 500x300! image.png

Resize multiple images.
mogrify -resize 500x300 *.png

How to install Debian packages (.deb files) on Ubuntu

The most easiest way to install a debian packages on Ubuntu, is by double click on the .deb file, and then select Install Package.

However, you could also install a debian package by using a terminal using this command:
sudo dpkg -i package_file.deb

To uninstall, use this command:
sudo dpkg -r package_name

Monday, September 14, 2009

One line command to update Ubuntu

I use this command to update my Ubuntu installation.
$ sudo apt-get update && sudo apt-get upgrade &&
sudo apt-get autoremove && sudo apt-get dist-upgrade

Monday, August 24, 2009

How to determine the linux distribution name or version

There are multiple ways to check what linux distribution and version you are using.

Here are some of them.
$ cat /etc/issue
Ubuntu 9.04 n l
$ uname -a
Linux riza-laptop 2.6.28-15-generic #49-Ubuntu SMP Tue
Aug 18 19:25:34 UTC 2009 x86_64 GNU/Linux
$ lsb_release -d
Description: Ubuntu 9.04

Saturday, August 22, 2009

Cursor jump to other location while typing on Ubuntu

Disable mouse clicks with touchpad
I am using Ubuntu 9.04 for my Dell Vostro 1400 laptop, and faced a very annoying problem where the cursor jump to other location - probably to the location of mouse arrow - while I am typing.

How do I solve this problem?

What I do is, I disable the "Enable mouse click with touchpad" in the "Mouse Preferences" dialog box.

To bring up the "Mouse Preferences" dialog, click on System > Preferences > Mouse.

Wednesday, August 19, 2009

How to install Adobe Flash Player plugin on Ubuntu

To install Adobe Flash Player plugin

sudo apt-get install flashplugin-nonfree

To check the current version, if installed using Aptitude (the method above)
sudo aptitude show flashplugin-nonfree

Saturday, August 15, 2009

Convert RPM package to deb package format on Ubuntu

How to convert RPM package to deb package format on Ubuntu, and install it with dpkg?

Step 1: Install the required packages

sudo apt-get install alien dpkg-dev debhelper build-essential

Step 2: Convert the RPM file


Run
sudo alien thepackagename.rpm
or
fakeroot alien thepackagename.rpm
and a .deb file called thepackagename.deb will be generated.

Step 3: Use dpkg to install the package

sudo dpkg -i thepackagename.deb

Sunday, August 2, 2009

How to download YouTube video on Ubuntu

You can download YouTube video with youtube-dl.

Install youtube-dl

sudo apt-get install youtube-dl

Download the video

youtube-dl http://the-youtube-video-uri

Convert into MPEG format

ffmpeg -i source.flv output.mpg

How to install Java on Ubuntu 9.04

To install Java support on Ubuntu, run this command in a Terminal:
sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin
You can also click here to test whether the JVM is working fine in your browser.

Saturday, August 1, 2009

How to enable Apache public_html for user on Ubuntu

Suppose that you want each user to have their own public_html in their home directory.

For example, user with username ahmad, can have his own Web site at
http://localhost/~ahmad


Enable mod_userdir

To achieve that, first, what you need to do is to enable mod_userdir, which is installed by default with Apache2.
sudo a2enmod userdir

Create public_html directory

Second, the user need to create public_html directory in their home directory.
mkdir public_html

Restart Apache

Finall, you should restart Apache.
sudo /etc/init.d/apache2 restart

Thursday, July 30, 2009

Convert CHM to PDF on Ubuntu

By default, you cannot view CHM file in Ubuntu. To view the CHM file, you can use GnoCHM. However, I found that GnoCHM is not so stable and crash a lot. Hence, another option is to convert it to PDF. What you need is the chm2pdf and python-beautifulsoup packages.


Install the packages

sudo apt-get install chm2pdf python-beautifulsoup

Convert the CHM file to PDF

chm2pdf --webpage --beautifulsoup filename.chm
You can even change colour, font, and margin of the generated PDF file. For more information on how to do so, please invoke
man chm2pdf
command on the terminal.

Determine CPU temperature on Ubuntu

Most PCs these days use ACPI. The ACPI shows information such as battery status or thermal information. Hence, to determine the CPU temperature on Ubuntu, you can use the acpi package.


Install the acpi package

sudo apt-get install acpi

Display the temperature


acpi options:
-b, --battery battery information
-B, --without-battery suppress battery information
-i, --capacity show battery capacity information if available
-a, --ac-adapter ac adapter information
-A, --without-ac-adapter suppress ac-adapter information
-t, --thermal thermal information
-T, --without-thermal suppress thermal information
-c, --cooling cooling information
-C, --without-cooling suppress cooling information
-V, --everything show every device, overrides above options
-s, --show-empty show non-operational devices
-S, --hide-empty hide non-operational devices
-f, --fahrenheit use fahrenheit as the temperature unit
-k, --kelvin use kelvin as the temperature unit

For example, to display information for every device, use the -V option.
$ acpi -V
Battery 0: Full, 100%
Battery 0: design capacity 7800 mAh, last full capacity 7791 mAh = 99%
AC Adapter 0: on-line
Thermal 0: ok, 36.5 degrees C
Cooling 0: LCD 0 of 7
Cooling 1: Processor 0 of 10
Cooling 2: Processor 0 of 10

Wednesday, July 29, 2009

View CHM file on Ubuntu

Microsoft Compiled HTML Help (CHM) is a common format for e-book and online documentation.

To view CHM file in Ubuntu, you need to have a CHM viewer installed. GnoCHM is one of the CHM file viewer, designed to integrate nicely with Gnome, using PyCHM.
GnoCHM CHM Viewer
GnoCHM can be installed by pasting the following command in the terminal.
sudo apt-get install gnochm
The shortcut will appear in Applications > Accessories menu as "CHM Viewer".
Access GnoCHM from the menu


This article discuss a simple way to view CHM file. If you know a better CHM viewer other than GnoCHM, please leave a comment.

Tuesday, July 14, 2009

How to use multiple windows in Vim

This article provides some tips on how to use multiple windows in Vim.

Start Vim with n multiple windows

  1. n verticals windows.
    vim -On filenames
  2. n horizontal windows.
    vim -on filenames
Note: n is the number of windows.

Close a window

  1. Close the current window.
    Ctrl+W c
  2. Close the current window. If it is the only window left, quit Vim.
    Ctrl+W q

Split a window

  1. Split horizontally the current file.
    Ctrl+W s
  2. Split horizontally and open a file.
    :sp filename
  3. Split vertically the current file.
    Ctrl+W v
  4. Split vertically and open a file.
    :vsp filename

Move the cursor between windows

  1. Move to the right window from the current windows.
    Ctrl+W l
  2. Move to the left window from the current windows.
    Ctrl+W h
  3. Move to the top window from the current windows.
    Ctrl+W k
  4. Move to the bottom window from the current windows.
    Ctrl+W j
  5. Move to the next window below the current one. If no below window exist, move to the top window.
    Ctrl+W w

Rotate windows location

  1. Move the current window to the right.
    Ctrl+W L
  2. Move the current window to the left.
    Ctrl+W H
  3. Move the current window to the top.
    Ctrl+W K
  4. Move the current window to the bottom.
    Ctrl+W J

Window resizing

Resizing windows can be made by using the mouse as well as the following commands.
  1. Make all windows equal in height.
    Ctrl+W =
  2. Increase height.
    Ctrl+W +
  3. Decrease height.
    Ctrl+W -
Note: Thanks to Ferd T-H, resizing could also be done by using
Ctrl+W < or >

Conclusion

I hope that these commands are enough for you to start using windows in Vim. However, if you know some good command(s) to please don’t hesitate to leave a comment.

Sunday, July 12, 2009

Friday, July 3, 2009

Archive and Compress Files Using zip

Zip and unzip are two free command line programs that comes with Linux. For Windows, they can be downloaded from the Info-ZIP Website. This article provides the basic of archiving and compressing files using the command line zip program.

Zip one file

zip filename.zip file_to_compress

Zip multiple files

zip filename.zip file_to_compress1 file_to_compress2 file_to_compress3

Compression options


The compression level ranges from 0 to 9. Level 0 means no compression, 1 compress faster, and 9 compress better. The default is 6.
zip -9 filename.zip file_to_compress

Password protect zip archive

zip -P the_password filename.zip file_to_compress

To be prompted for password instead of specifying the password in the command line, use -e instead of -P.
zip -e filename.zip file_to_compress
Enter password:
Verify password:

Unzip files

unzip filename.zip

Unzip files with informations (verbose mode)

unzip -v filename.zip

List files that will be unzipped

unzip -l filename.zip

Test Files That Will Be Unzipped

unzip -t filename.zip