Saturday, December 27, 2008

How to set environment variables in Ubuntu Linux

Here you can learn how to set up environment variables on Ubuntu.

Please follow the simple following steps:

1. Go to:
Applications > Accessories > Terminal
to open the terminal window.

2. You should take a back up of /etc/profile file. So write the commands:
sudo cp -p /etc/profile /etc/profile_backup

3. Now, to edit the /etc/profile file, write the following command in the terminal:
gksudo gedit /etc/profile
The file will be opened for editing.

4. You have to add one line at the end of the file. That line will tell the name of the variable and it's value.

Format for this command is:
export ENV_VARIABLE_NAME=VALUE
where ENV_VARIABLE_NAME is the name of the variable and VALUE is the value.

For example,
export JAVA_HOME=/mnt/F/ubuntu/j2sdk1.4.2_16
here /mnt/F/ubuntu/j2sdk1.4.2_16 - this path is the value of the variable JAVA_HOME.

5. Save your file and close it.

6. Restart your machine.

7. You can check if the value is properly set with these commands:
cd $JAVA_HOME
pwd

Right Alt key doesn't work? How to fix your right Alt key in Ubuntu?


Have you just noticed that your right alt key is not working in your Ubuntu?


Nope, don't be afraid, your button is ok. You just have to alter some option to make it behave like the left alt key.

1. First go to
System -> Preference -> Keyboard

2. Under Layout options tab, open the branch "third level choosers" and assign the third level chooser to any another key other than the right alt key.

It's done! :D

Synchronize Files Between your Desktop PC and Laptop

If you have two computers, you might want to synchronize data between the two. For example, if you have a laptop, you might want to transfer the files in your Documents folder to the main PC (and vice versa). You could do this manually by creating a network share, but it’s much better to do it automatically, with just a single click.

There are a variety of ways of synchronizing files under Ubuntu, and indeed, this is the kind of task that Linux excels in. However, perhaps the most fuss-free method is to use a program called Unison (or, actually, Unison GTK, which adds a graphical front end to the Unison command-line program; throughout I refer to the whole thing as Unison for simplicity). Unison uses built-in Linux tools to sync files but hides everything behind a friendly user interface.

The following are the steps required to sync the Documents folders on two separate computers using Unison. Before following these steps, ensure each computer has the correct time. This is essential because synchronization will fail otherwise.

These instructions make reference to a desktop PC and laptop computer but could be any two computers capable of running Ubuntu (or indeed any computer with Linux installed that can run Unison):

  1. On the desktop PC, use Synaptic to install the unison-gtk package. Meanwhile, on the laptop, use Synaptic to install the openssh-server and unison-gtk packages. As you might have guessed, Unison uses the SSH program in the background to provide the file transfer conduit but you won’t come into direct contact with it.
  2. Once installed on the desktop PC, Unison can be found on the Applications —> Accessories menu. When it starts, a wizard will walk you through creating an initial profile. The first step is to enter the folder on the desktop PC that you want to synchronize. Click the Browse button, and then locate your Documents folder. Click OK to close the file-browsing dialog box and OK again to move onto the next step of the wizard in Unison.
  3. In the next step, you must tell Unison which folder you want to synchronize with on the laptop. In the Directory text field, type Documents again. There’s no need to precede it with /home/username because Unison will automatically log into the laptop’s /home/ folder each time it synchronizes.
  4. Click the SSH radio button. You’ll now need to find the IP address of the laptop. This can be done by moving over to it, right-clicking its NetworkManager icon, and selecting Connection Information. Then look in the dialog box that appears for the line that reads IP Address. Type what you see (four numbers separated by dots) into the Host text field back on the desktop PC.
  5. In the User text field, still on the desktop PC, type the login name you use on the laptop. Then click the OK button.
  6. You’ll immediately be told that the laptop computer is being contacted. Then a dialog box will pop up telling you that the “authenticity of host can’t be established.” This is fine. Just type yes to continue, and hit OK.
  7. You’ll then be prompted for the login password on the laptop. Type it, and then click OK.
  8. After this, you’ll see a scary-looking warning dialog box saying that “no archives were found for these roots.” Don’t worry. This appears because this is the first time you’ve synchronized. Once you click OK, Unison will detect the files both on the desktop PC and on the laptop (it’s worth pointing out that you won’t see any sign of Unison running on the laptop, and you won’t have to do anything on the laptop—Unison runs automatically in the background).
  9. After a few minutes, the program window on the desktop PC will indicate the file differences between the two folders. The Path heading will show the file in question, and under the Action heading will be the “direction of travel,” indicated by an arrow—if the arrow points left, the file will be transferred to the desktop PC from the laptop. If it points right, the file will be transferred from the desktop PC to the laptop. If you don’t want to synchronize a particular file or folder, select it, and click the Skip button on the toolbar. However, assuming you’re happy with everything, click the Go button on the toolbar. The files will then be copied across. When Unison has finished (look at the status bar in the bottom left of the Unison window and the Status heading in the list of files), you can close the program window.

And that’s all there is to it. After this, you should run Unison on the desktop PC every time you want to sync the Documents folders on the two computers, such as when you get home from work. When Unison starts, just select default from the list.

Note that Unison always updates older files when synchronizing. For example, if you started a file on your desktop PC, transferred it to your laptop using Unison, and edited it while out and about, Unison would automatically overwrite the older file on the desktop PC with the updated version. This makes sense, of course. If the situation arises that the file gets updated on both machines between synchronizations, a question mark will appear alongside the file when you come to synchronize—see screenshot above—and it won’t get automatically copied across. You’ll then have to manually intervene to decide which to overwrite—the copy on the desktop PC or the copy on the laptop. Click the Right to Left toolbar button to overwrite the file on the desktop PC or the Left to Right button to overwrite the file on the laptop.

You can create additional profiles to sync other folders too—just click the Create New Profile button in Unison’s startup program window, type a name for the profile when prompted, and then double-click its entry in the list to start working through the wizard again. I find it useful to synchronize the Desktop folder on both machines because I tend to temporarily store a lot of files there. Don’t choose to sync your entire /home folder—hidden files are copied across too by Unison, and hidden files within your /home folder contain program configuration files unique to each computer. Upon synchronization there would be some almighty file clashes, and the likelihood of the login accounts on both systems getting damaged beyond repair because of mangled configuration files is high.

How to open .chm file Ubuntu and convert .chm file to pdf document


Do you want to open a .chm file in your Ubuntu?


Simple!!

For Gnome users, you may use the package "gnochm". Install it with this command:
sudo aptitude install gnochm
For KDE users, you may use the package "kchmviewer". Install it with this command:
sudo aptitude install kchmviewer
Do you want to convert from .chm to .pdf?

You can use this conversion tool:
sudo aptitude install chm2pdf

Simple enough, isn't it? :D