Thursday, November 13, 2008

Another Version of Ubuntu Is Out—How Do I Upgrade my current Ubuntu?

Automatic
-------------
If a new version of Ubuntu is released, the update manager will notify you via an upgrade notification pop-up bubble. To upgrade, click the Upgrade button, and follow the instructions.

Manual
----------
If you want to manually upgrade, first find out the codename for the next version of Ubuntu (in the same vain as Warty, Hoary, Breezy, and Dapper). Now open this file:

/etc/apt/sources.list


and replace the word "dapper" (or the code name of your current ubuntu) with the new codeword. Now run:

sudo apt-get updates


This command updated your package list. Now upgrade the system:

sudo apt-get dist-upgrade


You are asked if you wish to continue. Press Y, and then press Enter to continue. Your entire system is now upgraded.

source - http://www.informit.com/articles/article.aspx?p=667418

Thursday, September 11, 2008

Useful ubuntu commands for newbies/beginners

Privilege related commands:


sudo command - run command as root
sudo su - open a root shell
sudo su user - open a shell as user

sudo -k - forget sudo passwords

gksudo command - visual sudo dialog (GNOME)

kdesudo command - visual sudo dialog (KDE)

sudo visudo - edit /etc/sudoers
gksudo nautilus - root file manager (GNOME)
kdesudo konqueror - root file manager (KDE)
passwd - change your password


Display related commands:

sudo /etc/init.d/gdm restart - restart X (GNOME)
sudo /etc/init.d/kdm restart - restart X (KDE)
(file) /etc/X11/xorg.conf - display configuration
sudo dpkg-reconfigure -phigh xserver-xorg - reset X configuration
Ctrl+Alt+Bksp - restart X display if frozen
Ctrl+Alt+FN - switch to tty N
Ctrl+Alt+F7 - switch back to X display

System Services related commands:

start service - start job service (Upstart)
stop service - stop job service (Upstart)
status service - check if service is running (Upstart)
/etc/init.d/service start - start service (SysV)
/etc/init.d/service stop - stop service (SysV)
/etc/init.d/service status - check service (SysV)
/etc/init.d/service restart - restart service (SysV)
runlevel - get current runlevel

Package Management

apt-get update - refresh available updates

apt-get upgrade - upgrade all packages
apt-get dist-upgrade - upgrade Ubuntu version
apt-get install pkg - install pkg
apt-get remove pkg - uninstall pkg
apt-get autoremove - remove obsolete packages
apt-get -f install - try to fix broken packages
dpkg –configure -a - try to fix broken packages
dpkg -i pkg.deb - install file pkg.deb
(file) /etc/apt/sources.list - APT repository list

Network related commands:

ifconfig - show network information
iwconfig - show wireless information
sudo iwlist scan - scan for wireless networks
sudo /etc/init.d/networking restart - reset network
(file) /etc/network/interfaces - manual configuration
ifup interface - bring interface online
ifdown interface - disable interface

Special Packages

ubuntu-desktop - standard Ubuntu environment
kubuntu-desktop - KDE desktop
xubuntu-desktop - XFCE desktop
ubuntu-minimal - core Ubuntu utilities
ubuntu-standard - standard Ubuntu utilities
ubuntu-restricted-extras - non-free, but useful
kubuntu-restricted-extras - KDE of the above
xubuntu-restricted-extras - XFCE of the above
build-essential - packages used to compile programs
linux-image-generic - latest generic kernel image
linux-headers-generic - latest build headers

Firewall:

ufw enable - turn on the firewall
ufw disable - turn off the firewall
ufw default allow - allow all connections by default
ufw default deny - drop all connections by default
ufw status - current status and rules
ufw allow port - allow traffic on port
ufw deny port - block port
ufw deny from ip - block ip adress
Application Names
nautilus - file manager (GNOME)
dolphin - file manager (KDE)
konqueror - web browser/filemanager (KDE)
kate - text editor (KDE)
gedit - text editor (GNOME)


System:

Recovery - Type the phrase “REISUB” while holding down Alt and SysRq (PrintScrn) with about 1 second between each letter. Your system will reboot.

lsb_release -a - get Ubuntu version
uname -r - get kernel version
uname -a - get all kernel information

Thursday, September 4, 2008

How to mount a HDD partition in ubuntu

It's simple !

First of all, you have to create a mount point. A suitable place already is given: inside root, there is a directory named mnt. Inside mnt, you can create am empty directory where the HDD FAT/FAT32 partition will be mapped.

Create a mount point:

sudo mkdir /mnt/F

Now the next task is to find out the partition that we want to be mounted.

See the HDD partitions:

sudo fdisk -l

After this command, you'll see a list of partitions (both physical and logical). select the desired one for mounting. For example, you want to mount /dev/sda9 . So the command is:

sudo mount /dev/sda9 /mnt/F
But if the partition is of NTFS type; then use this command instead:
sudo mount /dev/sda9 /mnt/F -t ntfs -o nls=utf8,umask=0222
Done! now browse to /mnt/F and you'll get the HDD contents.

Wednesday, August 6, 2008

installing java and running a simple program

Hello all! I downloaded the jdk package from SUN's site and installed it offline. It's just simple.

offline istallation
---------------------

If you download the .bin file from Sun's site, then you can install it by:
sudo ./j2sdk-1_4_2_16-linux-i586.bin

online istallation
---------------------
sudo aptitude install sun-java6-jdk


Now, you have to set the path variables for JAVA:
export JAVA_HOME=/mnt/F/ubuntu/j2sdk1.4.2_16
export PATH=$JAVA_HOME/bin:$PATH

Now, switch to the directory /usr/bin :
cd /usr/bin

Now execute these commands sequentially:
sudo rm ./java
sudo rm ./java_vm
sudo rm ./javaws

sudo ln -s /mnt/F/ubuntu/j2sdk1.4.2_16/bin/java ./java
sudo ln -s /mnt/F/ubuntu/j2sdk1.4.2_16/bin/java_vm ./java_vm
sudo ln -s /mnt/F/ubuntu/j2sdk1.4.2_16/bin/javaws ./javaws
sudo ln -s /mnt/F/ubuntu/j2sdk1.4.2_16/bin/javac ./


You are done! Now you can run any java program from any directory you like.


Compiling your first java program

---------------------------------

You may write a sample code like this:
//First Java Program
class Main
{
public static void main (String[] args)
{
System.out.println ("Hello Ubuntu!");
}
}

Compile it:
javac Main.java

Run it:
java Main

you should get the output "Hello Ubuntu!"

installing and running gcc / g++ compiler in ubuntu


New to ubuntu? just stumbled upon installing gcc compiler and running a sample program? It's simple!

open up a terminal and write the command:

sudo aptitude install build-essential

It will automatically install gcc/g++ compiler into your system. Also you can do the same thing from the Synaptic package manager. Open the Synaptic package manager, search for a package "gcc" and then you will get the list of available packages. Just select g++ from there and install. Done !

To test it, write a simple C code like this and name it test.c:

#include
int main()
{
printf("Hello ubuntu!");
return 0;
}

to compile it:
g++ -lm -o test.o test.c

here -lm indicates that the compiler may invoke the math library. test.o is the name of the object file.

finally, you can get the output by executing the object file:
sudo ./test.o

Here you can find details of the build-essential package:
http://packages.ubuntu.com/hardy/build-essential