Hello guys, I am a truely Linux
lover
.
While learning Linux for first time I found many difficulties. There are
a lots of commands associated with every single task. Even many of them require
me to input many command
line arguments, otherwise they'll not work and show me error. For every command
to work I used to need to look
after the help and things got to be messed up to me. ...after a rigorous work,
finally I learned them and 've found
that they are amazing. Every single command and command line programs have
tremendous power themselves.
So, I've decided to help you to learn the basics of linux if are a novice to
linux world, but love it truely.
Installation and basics idea about Linux:
I'll guide you to installing Linux in your computer. I prefer to work on Red Hat
release and Mandrake Linux release.
If you are a desktop user then Mandrake Linux is best suited for you. Though I
am not telling you that other Linux distributions are not good. Some best
distributions are
1. SUSE Linux release
2. RedHat Linux release
3. Mandrake Linux release
4. Open Linux(from Caldera)
5. Debian Linux
Before installation, first make sure what type of hard-disk you have-
1. is it SCSI or not ?
2. is it 10.2 or higher ?
In case of SCSI, when the installation wizard asks you, you should check the box
that you have SCSI disk,
otherwise uncheck it. First make a partition free for Linux. This can be best
done using Windows's "fdisk" tool.
If you have Windows as your primary O.S. then go to MSDOS prompt and issue the
command "fdisk"(without " ").
Then a menu will appear. Choose "delete logical drive" and accordingly delete
the logical dos drive
(say D or E or...) you want to accomadate for Linux. It'll be best to delete
only the last logical dos drive.
Before doing this, backup the drive if you've important files and free that. For
Linux, giving a partition of
around 1 GB to 3 GB is sufficient. Refer to the manual of you Linux. Then reboot
it. Yah...you're done.
Boot your computer using the CD1 and after some time you'll be presented with
the graphical installation
wizard. For Linux partion choose a swap drive ( used by Linux for data swapping
with RAM ). For better result
the swap partition should've
size = 2 x ( size of your RAM ) + 25 Mb. Make a /boot partition if you've
hard-disk of size greater than 10, also
this'll give you better result in case of RedHat Linux. Otherwise it may happen
that the boot partition may fall
outside the 1024 cylinder area of the disk. The /boot should have size equals to
16 to 20 Mb of Ext2 type.
Then go ahead and create all other partions. Suggested configuration-
SWAP = 2 x (size of RAM) + 25 Mb
/boot = 16 to 20 Mb
/ = rest of the free space Install LILO as your boot loader as it is good enough
to handle multiple O.S in MBR
( if any option there). If you want to experience the graphical power of Linux
then choose either KDE or GNOME
or both as the window managers. You'll be prompted to enter the root's
passwd-know that root is the main user
who've all the power of Linux. Working as root is also dangerous as you can
destroy system files. So, for desktop
user, I advise you to chose another general user and always login through this
user. It'll be safe for both you and
your computer. OK then...relux, while it is being installed.
Help is always at your hand :
In
Linux HELP is always at your hand...only
problem is that you have to find it
yourself. I'll assume you that are in
text mode or you have opened a shell window
( just like MSDOS shell ) in graphical mode.
In linux you can learn
about any command or program using this
command
> "command
name" --help or
> "command name" -h
This'll produce a list of available options(
switches) to you and a detailed
descriptions. You can learn about
any command or program by using the "man"
command or "info" command. Linux reserves
the manuals of
any program or command. You can read this
manual with the "man" or "info" command.
For e.g. issue the command at the terminal
window as
>man "command name" or
>info "command name"
After reading you can terminate man or info
by pressing the "Q" button of your keyboard.
Most of the Linux programs
can be quited by pressing the "Q" button.
Some types of manuals are given below to
help you learn more
/usr/man/man1-various
commands
/usr/man/man2-system calls-documentation for
kernel functions and system calls
/usr/man/man3-Library calls
/usr/man/man4-Information about the files in
/dev
/usr/man/man5-various file formats
/usr/man/man6-The Linux Games
/usr/man/man7-Description of linux file
systems
/usr/man/man8-Administrations
/usr/man/man9- kernel's modules
Lern how to navigate directory:
In linux directory nevigation is very easy.
Just like DOS you can use the "cd"(change
directory)command to simply
move between directories. The main directory
tree structure of Linux, you'll see is as
follows
/
|--/bin(contains all the main commands execution files)
|--/etc(this dir is used by system administrator as it contains system adminis. files)
|--/dev(contains device related files)
|--/opt
|--/home(Your home where you'll save most of your files and documents, like Windows's
"My Documents")
|--/mnt(used for input/output to cdrom, floppy, zip drive, Windows's partitions and others)
|--/tmp(temporary directory used for keeping temp. files)
|--/root(root's dir)
|--/var
|--/sbin(some programs and additional commands)
|--/usr(user's software and their documentations)
In some system it
could differ.
Directory nevigation is basically done by cd
as I told you earlier. The basic command is
>cd /usr/bin --will move you to bin
directory in /usr.
For mooving to the root directory from
anywhere the command is >cd /
For moving to the home dir from anywhere the
command is >cd ~(tilde sign)
For moving up one dir >cd ..(two dots
preceeding space)
The command "pwd" is used to print the
current working directory. In Linux
everything is treated as files,
even directory or devices too.
So you have learnt how to move around
between directories. Please move to next
page
Finding something:
Now after some time you'll be able to find
some specific files. Let's start.
To find any file issue this command > find
"dir name where to find" -name "file name"
-print. For example to
find the file inittab in /etc dir I can
issue the command
>find /etc -name inittab -print. This'll
search the /etc directory and list it.
To find a rescently created/modified file
the option -atime is used as >find / -type f
-atime +10 -print. This'll find the
file that was created in the last 10 days
ago. >find / -type f -mtime (no. of days)
-print will print that file that was
modified.
Wildcard chars. can be used for searching
files. The command >find /home -name *.jpg
-print will search for the
jpeg pic. files.
If yo want to where a particular file is
located use "whereis" as >whereis (command
name say "cd").
If can not remmember a particular command or
want to know some apropriate command for a
particular task
then use "apropos" command.
For example, >apropos text editor --will
print all the available text editor in your
system.
Reading files:
(1) "ls" command is used for listing the
files or directories in the current
directories. The option -l will give you the
long listing format,i.e, the
r(read)w(write)x(execute) permissions, date
of creation etc. For listing specific files
use as >ls *.jpg.
(2) "dir" can similarly be used as used in
DOS. "vdir" is similar to >ls -l.
(3)"cat" command is used for displaying
contains of a files to screen.E.g. >cat
(file name say myfile.txt) will print the
contents of a file to screen. >cat -n
myfile.txt will associate line no.
(4)For suitable reading you can use the
"more" command as similar to DOS's more
command. E.g. >cat myfile.txt | more will
help you to read suitably if the contents of
myfile.txt doesn't fit to screen. You have
to press enter key for moving.
(5)"less" is very usefull for reading
purpose. You can move upward or downward
using the arrow keys.
E.g. >less myfile.txt.
Creating files:-
(1)The "cat" command can be used to create a
short text files without running any text
editor.The syntax is >cat > myfile.txt
--this'll prompt you to write something
texts. After you've finished press Ctrl+D to
save and close the file. The redirection
operator ( >) can be used to combine
files.E.g. >cat *.txt > new.txt --will
combine all *.txt files to new.txt file. For
appending >> is used as >cat 1.txt >> 2.txt
-- contents of 1.txt will be appended to
2.txt file. (2)The "touch" command is used
to create 0 bite file or modifying the time
of creation of an existing file.
Creating directories:-
Directory creation is very easy in Linux.
Issue the command to create a single
directory >mkdir /home/temp --this'll create
a new directory temp under home. You cann't
create a directory under a one that doesn't
exist.For e.g., say, suvo dir. is not
present and I try to create a dir temp_239
under it, then this command >mkdir
suvo/temp_239 will show an error. Better try
in this case the -p switch as >mkdir -p
suvo/temp_239.
Removing files:-
Files can be removed using "rm" command.
>rm temp1_file, > rm tempFile1 tempFile2.
****REMEMBER
ALWAYS, LINUX IS VERY CASE SENSITIVE TO FILE
NAME****
You cann't delete a file which don't have
enough permission, i.e., if the file is
created by other user or root and it is not
granted by him/her to delete. Other options
with "rm" are: -i = interactive, -f =
forcing to delete.
Removing directories:-
Use "rmdir" as >rmdir suvo/temp_239(assuming
temp_239 is empty), you can recursively
delete the files as well as the directory
using -r option. Also to remove the parent
dir with the child use -p option. "rm" can
also be used with -d(or --directory) option
to delete a dir.
Renaming and moving files or
directories:-
Very easy. Use mv to rename a file or dir.
or to move to another place( just like cut
and paste ) as
>mv suvo raj --rename suvo(either file or
dir) to raj
>mv raj /opt --move raj to /opt
Installing software:
In Linux the various softwares can be any of
the following formats
A. compressed format
*.tar
*.tar.gz
*.bz2
*.Z
*.zip
B. RPM format(*.rpm)
For *.tar file use >tar -xvfw abc.tar ( -x =
extract, -v = verbose, -f = file, -w =
interactively).
For *.tar.gz use >tar -zxvfw abc.tar.gz ( -z
passes through "gzip" program).
For *.bz2 use >bzip2 -d(--decompress)
abc.bz2
For *.Z use >uncompress abc.Z
After compressing you may find some file in
the dir as "README" or "INSTALL" or like
that. Read the file using "less" to perform
other operations as directed there to
complete the software installation.
Sometimes you will be instructed to run some
script( similar to batch file *.bat in DOS).
RPM means RedHat Package Manager - this is
invented by RedHat to distribute software in
an easy way. RPM takes care of all the
installation process. You need n't be
wooried. In this case use
>rpm -ivh filename.rpm( -i = install, -v =
verbose, -h = prints hash char(#) as
progress bar). To uninstall use rpm -evh
filename.rpm ( -e = erase ). To perform
quary use rpm -q filename.rpm( this'll tell
you if the s/w is installed or not )
This is the end of the tutorial but not the
last. I am going to prepare other new
tutorials on "how to write linux shell
script" and "how to develop C\C++ program in
Linux" if you encourage me to do so. Ok, the
miscelenaous commands those can not be
grouped together in a category are described
below.
(1)"cp" is used for copying files and
directories to other places without
replacing the original.
(2)"mount" is used for mounting some file
system on devices( such as floppy, cdrom,
zip drive, Windows drives etc). You must use
"umount" to unmont that system.
(3)"chmod" is used to change the
read+write+execution permission of a file or
directory.
(4)"date" is used to change the current date
of the Linux system.
(5)"time" is used to change the current time
of the Linux system.
(6)"umask" is used to change the default
r+w+x system.
(7)"mc"(midnight commander) is basically a
shell(command interpreter), but it offers a
nice directory navigating structure.
(8)"echo" command is used to output
something on the screen.
(9)"ps" command is used to list all the
processes those are currently running and to
get their Process ID(PID) number.
(10)"kill" is used to terminate a running
process.
(11)"mail" is used to send mail to other
user.
(12)"su"(super user)changes the general user
to login as root.
(13)For shutting down the system use
"/sbin/shutdown -h now"(before doing this
you have to use "su" if you are in general
user mode).
(14)For rebooting down the system use
"/sbin/shutdown -r now"(before doing this
you have to use "su" if you are in general
user mode).
Some quick notes:-
1.Suppose you have a CD containing a
software "myswr2.7.8.i386.rpm" and you want
to install it in your computer. What steps
should you do-
$cd /home
$su(this'll prompt you to enter the root's
password)
$mount /mnt/cdrom
(if no error)$cd /mnt/cdrom/"software
directory"
$ls -l *.rpm(check to see if it is present
or not)
$cp myswr2.7.*.rpm /tmp
$rpm -q myswr(this'll check if myswr is
installed or not)
(if not installed)$cd /tmp
$rpm -ivh myswr*.rpm
umount /mnt/cdrom
$eject(it'll eject the CD from the cd-tray
$myswr --help
myswr -a -b -c "...." &(to run in the
background & operator is used with program)
2.Suppose a program got hanged, then follow
the steps as mentioned:
$cd /home
$ps(get the PID of the hanged process)
$kill "PID no"
This'll solve your problem.
|
|
|
No comments:
Post a Comment