Why Use Linux

Problems with the Windows systems


a) It cost money.
b) Source code is not open.
c) Virus prone systems.
d) Monopolistic attitude.
e) Security Problem
f) Not configurable. i.e. One can't configure Windows desktop as his way.

Advantages of Linux-like systems


a) Open Source.
b) Free.
c) More secure than windows system.
d) Configurable. One can configure each and every thing in Linux in his own way.
e) Linux is multi-user.
f) Stability.
g) Varieties.
h) Server capabilities.
i) Not a virus prone system.
Installation In Linux

Installation and Uninstallation from RPM:


RPM is a pre-compiled binary for linux (similar to setup file in windows). Install RPMS by using command rpm as:

# rpm -ivh gaim-0.81-0.rpm
Here options are : 'i' for 'i'nstall; 'v' for 'v'erbose and 'h' for hashing
It will install the software named 'gaim'. If it will ask for some dependency, then first install the 'rpm' which provides
that dependency. Use google to find which 'rpm' which rpm will provide the dependency.
To uninstall, you should first know which rpm is to be uninstall. To find that, type

# rpm -aq | grep gaim
Here options are: 'a' for 'a'll and 'q' for 'q'uery. i.e. "rpm -aq" first finds all the rpms installed on the computer. Then "grep gaim"
will filter the rpms having name "gaim". If you dont know what the "grep" do, please read "Basic Command In Linux" first.
The output of this command will be something like
gaim-0.81-0
Now to uninstall 'gaim', type

# rpm -e gaim-0.81-0
Option 'e' is for 'e'rase.

More About RPM
If you run across a file that you don't recognize. To find out which package owns it, you would do:

# rpm -qf /usr/X11R6/bin/xjewel
The output would be sometime like:
xjewel-1.6-1

If you find a new koules RPM, but you don't know what it is. To find out some information on it, do:

# rpm -qpi koules-1.2-2.i386.rpm
The output would be:
Name : koules Distribution: Red Hat Linux Colgate
Version : 1.2 Vendor: Red Hat Software
Release : 2 Build Date: Mon Sep 02 11:59:12 1996
Install date: (none) Build Host: porky.redhat.com
Group : Games Source RPM: koules-1.2-2.src.rpm
Size : 614939
Summary : SVGAlib action game with multiplayer, network, and sound support
Description :
This arcade-style game is novel in conception and excellent in execution.
No shooting, no blood, no guts, no gore. The play is simple, but you
still must develop skill to play. This version uses SVGAlib to
run on a graphics console.

If you wants to see what files the koules RPM installs. You would do:
# rpm -qpl koules-1.2-2.i386.rpm
The output is:
/usr/doc/koules
/usr/doc/koules/ANNOUNCE
/usr/doc/koules/BUGS
/usr/doc/koules/COMPILE.OS2
/usr/doc/koules/COPYING
/usr/doc/koules/
/usr/doc/koules/ChangeLog
/usr/doc/koules/INSTALLATION
/usr/doc/koules/Icon.xpm
/usr/doc/koules/Icon2.xpm
/usr/doc/koules/Koules.FAQ
/usr/doc/koules/Koules.xpm
/usr/doc/koules/README
/usr/doc/koules/TODO
/usr/games/koules
/usr/games/koules.svga
/usr/games/koules.tcl
/usr/man/man6/koules.svga.6

Installation and Uninstallation Using Source :



Steps for installation:

1) Source Code always come in .tar.gz or .tar.bz2 format. First unpak the source code. If you dont know how to unpack it, please
read "Basic Commands in Linux" first. e.g. If you want to install mplayer using source code, unpack it as

# tar -jxvf MPlayer-1.0pre5.tar.bz2

2) Now change the dirctory to Source Code. i.e.

# cd MPlayer-1.0pre5

3) Now you must see a file name "configure" in that directory (type ls to see that). If this file is absent, that means it is not the source code. If the file is there, type

# ./configure
This will check your system configuration. If it fails, see the error (which is mostly due to some dependency) , first install the dependency and then try again.
This command "configure" will make the file named "Makefile".

4) Type

# make
This will compile the package.

5) Type

# make install
This will install the package.

6) You can delete the source code now.

Steps for uninstallation:

You can uninstall the package installed using source code by the same source code.
1) Unpack the source code in same directory from where you have installed it. e.g. If you have installed MPlayer from
directory having absoulte path as "/extra/multimedia/MPlayer-1.0pre5", then you should uninstall it from the same directory.

2) Type

# ./configure
If you have given some options to "./configure" during installtion, you must give the same options here.

3) Type

# make

4) Type

# make uninstall

5) Now you can delete the source code.
Basic Commands In Linux (for newbies)

Basic Linux Commands : without which you can't survive in technical world!!!



1) ls -- to list files and directories
Examples: ls Mail, ls -a
ls -l /usr/bin
Options: -l, -a

2) cd -- Type cd followed by the name of a directory to access that directory.
Examples: cd games, cd ..
Imp: "cd -" will get you in the last working directory

3) pico -- To create or edit a file
Examples: pico myfile.txt, pico

4) vim -- Advance text editor
Example: vim myfile.txt
To learn basic vim, visit: https://www.dynamic-apps.com/linux_vim.jsp

5) chmod -- change file access permissions
Example: chmod -R 753 games

Permissions
alias
weightage
read
r
4
write
w
2
execute
x
1


In 753, the first 7 (1st letter) represents the permissions to himself, 5 (2nd letter) represents the permissions to group.
3 (3rd letter) represents the permissions to others.

Options: -R for whole directory
7=4+2+1 ; 5=4+1; 3=2+1

6) pwd -- shows the "present working directory"

7) cp -- copy the files/diectories
Examples: cp oldfile.txt newfile.txt
cp -R olddir newdir
Options: -R for copying complete directory

8) mv -- move or rename the file/directory
Examples: mv oldfile.txt newfile.txt
mv olddir newdir

9) rm -- remove files/directory
Examples: rm file1.txt
Options: -r deletes whole directory
-f deletes without asking confirmation

10) mkdir -- make a new directory
Examples: mkdir games

11) rmdir -- deletes a (empty) directory
Examples: rmdir games

12) man -- show the manual pages
Examples: man mkdir
man man

13) date -- show date and time

14) cal -- show calendar

15) du -- show file space usage
Examples: du -hs games; du ; du movie.dat
Options: -h print sizes in human readable format(e.g., 1K 234M 2G)
-s display only a total for each argument

16) passwd -- to change passwd

17) pine -- to check mails

18) logout -- make you exit

More Basic Commands -- without which you can't survive in IITB!!!



1) tin -- to check newsgroups

2) telnet -- to login into other computer/server
Example: telnet 10.107.1.2
Imp: Try command 'rlogin'

3) ssh -- secure login into other computer/server
Example: ssh agoyal@10.105.1.11

4) finger -- look for information about users logged on server
Example: finger; finger agoyal

5) talk -- talk to other user
Example: talk agoyal

6) w -- Show who is logged on and what they are doing

7) write -- write to other users
Example: write agoyal

8) ftp -- to transfer files from one computer to another
Example: ftp 10.105.1.11
Use 'gftp' for graphical interface

9) cat -- print the file(s) on standard output
Example: cat myfile.txt
Imp: Try commands 'head', 'tail', 'less', 'more'

10) alias -- alias a command
Example: alias rm='ls'

Advance Commands -- without knowing which you can't be called "STUD"



1) df -- show harddisk partitions
Example: df -h

2) locate -- locate a file containing some expression
Example: locate games

3) grep -- print lines matching a pattern
Example: locate games|grep nfs

4) find -- search for files in a directory hierarchy
Example: find . -name filename -print

5) ps -- report process status
Examples: ps; ps -aux

6) top -- display Linux tasks

7) kill, killall -- kills a process
Examples: kill -9 1290; killall -9 mplayer
Here -9 is an option to kill a process completely. 1290 is a process ID (PID).

8) tar -- compress/uncompress files/directories
Examples: tar -xvf file.tar -- uncompress a file 'file.tar'
tar -xzvf file.tar.gz -- uncompress a file 'file.tar.gz'
tar -xjvf file.tar.bz2 -- uncompress a file 'ffile.tar.bz2'
tar -cvf file.tar file -- compress the file 'file' to 'file.tar'
tar -czvf file.tar.gz file -- compress the fille 'file' to file.tar.gz
tar -cjvf file.tar.bz2 file -- compress the fiile 'file' to file.tar.bz2

9) file -- determine file type

Some More fundaes: for cool dudes



1) How to open graphical applications from other computer?
Suppose you are sitting on comp 'A' with ip 10.8.1.82. You want to open an graphical application on comp 'B' with ip 10.8.1.22. Do the following:
a) type "xhost +" on comp 'A'
b) login to comp 'B' via 'ssh' or 'telnet'
c) type "export DISPLAY=10.8.1.82:0.0" on command prompt of comp 'B'
d) open the application. e.g. 'gftp'

2) Use for the command completion
3) Don’t waste time and energy retyping commands at the prompt. Instead, use the ! option. To automatically re-display the last command
you typed at the prompt, type: !! and press enter. Press again to invoke the command. You can also automatically re-display a command you
typed earlier by using the ! and the first few letters of the command.

Ex: At the Linux prompt you had typed the command clear, followed by the command pico, followed by the command ftp. In order to re-display the
clear command you type: !cl and press enter. In order to re-display the last command you typed, simply type: !! . Try it out. You’ll find this a time
saver when dealing with long commands. Especially commands like tar!

4) You can also use reverse search for retyping commands. e.g. type "Ctrl+r", and then type few letters of command. It will display the command.

Common Softwares in Linux



Some common softwares you will need:
1) gaim -- Instant Messenger like yahoo and msn messenger.
2) mplayer -- Movie Player like Windows Media Player in Windows.
3) xmms -- Play Songs like winamp in Windows.
4) openoffice -- Run Office Application like officexp, office2k3 in Windows.
5) mozilla -- To browse internet like Internet Explorer in Windows.
6) gftp -- for transfering files.
7) gimp -- for creating/editing pictures.

See the complete Linux Windows Equivalence Table in the last section
Windows-Linux Equivalence Table
This is the best resource we can get from the web : Windows - Linux Equivalents
Compiling a Linux Kernel
This is the lazy man's guide to compiling a kernel. It wouldn't hurt to read the kernel howto, however, I'm assuming that you've
got a basic idea of what you do and just want a quick refresher.
NOTE: This is for the 2.4 kernel. This page is really dated, but I'm leaving it up for the moment.

Another good quick guide is Skylinux's......

So, first download the latest kernel source from https://www.kernel.org/. the latest stable version could be found at
www.kernel.org/pub/linux/kernel (I haven't put a link to it, since, as new kernels come out, it will soon be dated.) Or do it via ftp
ftp ftp.kernel.org When it asks for a login name put anonymous
You'll then see a message that anonymous logons are ok and that you should send your email as password.
cd /pub/linux/kernel/v2.4 (or whatever version it is that you want hash get (filename)
The filename will be something like linux-2.4.8.tar.gz or .bz2 depending upon your choice. (One thing here, in an xterm or
console window, it's sometimes difficult to see the name of the file that you want. The hash command is optional--I use it because
it produces hash marks as it downloads, giving me an idea of progress.

Do as much of this as you can as user. At some point, you will have to su to root, but as they say in the README, don't take root's
name in vain. Keep going till you get permission denied. :)

download it directly into /usr/src. Otherwise, just move the file once it's been downloaded. (I think this is where you have to su to root.
We'll use linux-2.4.10.bz2 as our example.

mv linux-2.4.10.bz2 /usr/src/
Change into that directory
cd /usr/src
If you already have a working configuration, back it up--in that case there will be a directory called linux already there (again, this is aside from RedHat)
mv linux linux.bak
Untar the file you just downloaded--if it's a bz2 then
tar -jxvf linux-2.4.10.bz2
You now have a directory in /usr/src called linux
cd linux

Now you have a few choices. If you want to start from scratch then do

make mrproper

This will start you off with a totally fresh kernel. However, if you've saved a config file from a previous build, and have copied it into /usr/src/linux once
you untarred the latest kernel, don't make mrproper, as it will lose your old configuration. Either way, the next step is to

make xconfig

That is one choice, and probably the easiest. It has help for most of the choices (the kernel howto mentioned above gives additional
help.) The other choices are:

make config
make menuconfig
make oldconfig
make config gives you a menu that offers help (type ? whenever it's listed as a choice) but has the disadvantage that you can't go back
once you've made a choice. Difficult for bad typists like myself.

make menuconfig is a textlike (although it is graphical) menu. You have the option to go back if you've made mistakes.

make oldconfig takes your old configuration (that will be gone if you did make mrproper) and uses it. I've found it handy in recompiling
RedHat on an older machine (see my RedHat article listed above) or when just using patches. (see below.)

When done, regardless of the menu you've chosen, you're then asked if you want to save the new configuration. Assuming your ready to risk it, choose yes.

Next

make dep; make clean; make bzImage

The bzImage part is what is going to take awhile. On an AMD 1 Gig processor with 256 megs of RAM it takes me about 10 minutes--on a low end, older
machine (K6-II 450 with 192 megs of RAM) it takes about 30 minutes. Here is where you might get error messages if you've left out something important.
Assuming you didn't, once that's done

make modules; make modules_install

(Actually, one only needs to type make once--you could simply type make dep clean bzImage modules modules_install---I like to pause after bzImage to
make sure there are no errors)

it's not that important whether one does make dep clean or make clean dep---doing a make clean will NOT clean out the dependencies that you just made.

many people think that you should do make modules modules_install before doing make bzImage. I've never seen it dogmatically stated either way--the make
modules modules_install option is listed after make bzImage in the 2.4.14 kernel README, the kernel howto and RH's kernel howto. I've always done it that way
without problems--however, others have done make modules modules_install before making the bzImage. To be safe, just keep the groups together--that is make
dep clean and make modules modules_install. The make dep clean (or clean dep if it makes you feel safer) should come first. Then, either make bzImage or, if you
want to try it make modules modules_install. Then, lastly bzImage or the two modules commands, depending upon which one you did previously. I reiterate, I have
heard that people do the make modules modules_install step first without problems, but I have never done it that way.

A RedHat default kernel is modular, and has a lot of default modules that are unneeded--in such a case, this part too can take awhile. If you've done a monolithic
kernel (that is, with no modular support) you can skip this part--otherwise, you'll get an error message. However, if you have chosen to enable module support, even
if you haven't used any modules, don't skip it.

Next, we copy the bzImage over to boot

cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.10

This is assuming that the new kernel is 2.4.10, obviously.

If you're using Grub, add the following entry to grub/menu.lst or grub/grub.conf (depending upon your distro.) Let's assume that your 2.4.9 kernel is on /dev/hda2
or (hd0, 1) in grub terminology. So, say grub already has the lines:

title Linux
root (hd0,1)
kernel /boot/vmlinuz-2.4.9 ro root=/dev/hda2

Add the lines

title Linux New
root (hd0,1)
kernel /boot/vmlinuz-2.4.10 ro root=/dev/hda2

In other words, you're adding a new title and a new boot image. The rest of it will be identical to what you already have.

If you're running LILO then say you have the lines:

image=/boot/vmlinuz-2.4.9
label=linux
read-only
root=/dev/hda2

Then add:

image=/boot/vmlinuz-2.4.10
label=linuxnew
read-only
root=/dev/hda2

Again, an almost duplicate entry, simply adding a new label and new boot image. Then, run lilo

/sbin/lilo

You should see a message that it added linux and added linuxnew (Note that with lilo there can be no spaces in the label)
v Now reboot, and see what happens. If it doesn't boot for some reason, see if the error messages give a clue, go back and once again run make menuconfig
(or whichever you chose) and see if the error can be fixed. If it boots, and hangs at

Ok, uncompressing the kernel

that often means you chose the wrong processor during configuration. If it does work, you might want to keep the old configuration around for a few days to
make sure there's nothing you've forgotten, then you can delete the vmlinuz-2.4.9 in your /boot partition and also get rid of the linux.bak drectory.

Lastly, patches. Rather than downloading an entire kernel, you can simpy download the patch. Move it to /usr/src

mv patch -2.4.10.bz2 /usr/src/

Directions for applying it are in the linux/README

cat linux/README | grep patch

They're quite smple--if you've downloaded a bz2 file then it's

bzip2 -dc patch-2.4.10.bz2 | patch -p0

If you downloaded a .gz file then it's

gzip -cd patch-2.4.10.gz | patch -p0

(This should be done from /usr/src) You can check that your kernel has been upgraded by checking the Makefile head linux/Makefile

You should see

VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 10
This indicates that your kernel has been successfully patched. However, if you reboot, you'll see that you're still running the 2.4.9 kernel.
The next step is cd back to /usr/src/linux

make oldconfig; make dep; make clean; make bzImage

and from there, continue with the steps given above

make modules; make modules_install

cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.10

When you reboot, you should see that your kernel was successfully upgraded. Well, as said, this is a brief list of instructions. It should help to get you started