Saturday, February 16, 2008

How To Restore Grub/Lilo (boot loader)

if you want to install windows and Linux on the same machine (this is called Dual Boot) you MUST install on this order:

Windows 3.11
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Linux

Let Linux be the last OS installed, as it can boot any other OS.
If you lost your Boot Loader and now only windows boots up (it happens if you install Windows on a system that already has Linux Installed)
take a Linux Install CD and boot with it.

press CTRL+ALT+F2. It will give you a text mode interface. then execute this commands:

mkdir /linux
mount /dev/hda1 /linux
chroot /linux


if you want to use LILO:
check your /etc/lilo.conf and run:
lilo
restart


if you want to use GRUB:
grub
find stage1
root (hdX,Y)
change X,Y with the result from above command
setup (hd0)
quit
restart


Atention:
Remember to change hda1 to whathever your Linux partition is...
/dev/hda1 => First partition on the Primary Master IDE HD
/dev/hda2 => Second partition on the Primary Master IDE HD
/dev/hdb1 => First partition on the Primary Slave IDE HD
/dev/hdb2 => Second partition on the Primary Slave IDE HD
/dev/hdc1 => First partition on the Secondary Master IDE HD
/dev/hdc2 => Second partition on the Secondary Master IDE HD
/dev/hdd1 => First partition on the Secondary Slave IDE HD
/dev/hdd2 => First partition on the Secondary Slave IDE HD
/dev/sda1 => First partition on the First SATA HD
/dev/sda2 => Second partition on the First SATA HD
/dev/sdb1 => First partition on the Second SATA HD
/dev/sdb2 => Second partition on the Second SATA HD


.

Mouse Pointer Not Showing in Linux...

I have installed Linux Fedora core 7 ,every thing worked fine except mouse..
The problem i faced was that is was not showing mouse pointer.But it was there..

After a lot of hit and trail method i got success..

So here is the solution :-
Open the /etc/x11/xorg.conf

append option "HWCoursor" "false"

in "Section Device" section

Back up your xorg.conf file before editting...

Monday, February 11, 2008

How to compile & execute C programs under Linux (Absolute basics)


This article is for those guys who used to write a lot of programs under Windows.. and now have entered the Linux territory. You have probably heard a lot about Linux and how you can do some real good programming under Linux. But right now you cant even get the simplest of Hello World programs to compile.
Here's how you do it -

Procedure :

You can type you C program using any of the editors that are available under Linux such as vi or emacs or any other editor.

Once you have written and saved your C program using any editor return to the prompt. An ls command should display your C program. It should have the .c extension. Now at the prompt type the following

$ gcc -o firstprogram firstprogram.c

If your file is named firstprogram.c then type '-o firstprogram' as the parameter to gcc. This is basically your suggested name for the executable file that gcc would create. In case you typed something like the following

$ gcc firstprogram.c

You would be having a a.out in the same directory as the source C file. This is the default name of the executable that gcc creates. This would create problems when you compile many programs in one directory. So you override this with the -o option followed by the name of the executable

$ gcc -o hello secondprogram.c

Would create an executable by the name hello for your source code named secondprogram.c

Running the executable that you created is as simple as typing the following at the prompt.

$ ./firstprogram
OR
$ ./hello

Or whatever you named your executable.

This is the absolute basics of compiling C programs under Linux.