Friday, April 30, 2010


Run level defines which services will start during booting. There are seven runlevels (0-6). A runlevel is a software configuration of the system that allows only a selected group of processes to exist. Init can run the system in one of eight runlevels. These runlevels are 0-6 and S or s. The system runs in only one of these runlevels at a time. Runlevels 0,1, and 6 are reserved. The runlevels are as follows:-

0(rc0.d)-halt (Don't set init default to this.)
1(rc1.d)-Single user mode.
2(rc2.d)-Multiuser without network file system(nfs)
3(rc3.d)-Multiuser mode (boot up in text mode.)
5(rc5.d)-Multi user mode boot up in X-windows.
6(rc6.d)-Shutdown & Reboot(Don't set init default to this.)

Sunday, April 11, 2010

Virtual Console

Here I am talking about how we can create virtual consoles (shell screen):-
In RHEL (Red Hat Enterprise Linux) we have six virtual consoles by default we can switch to any one by pressing Ctrl+Alt+F[1-6] and back to GUI by Ctrl+Alt+F7.
If we want to create some more virtual console(we can create up to 63 virtual consoles) we can:-
Suppose we want to create virtual console no. 22 here are the steps:-
1. Open inttab file the
vim /etc/inittab 
2. Add line in 'Run gettys in standard runlevels'
"22:2345:respawn:/sbin/mingetty tty22" the same parameter we will be follows as given for other consoles.
3. Save the inittab file and exit
4. Run command "init q" to re-examine the inittab file.
5. Now If we give command "chvt 22" at prompt a new shell screen will appear. But we can't login since the user (root) is not allowed to login in the shell.
6. Open "/etc/securetty" file and add line as given "vc/22" and "tty22" in the file.
7. Save the securetty file and exit.
8. Now run the "chvt 22" at the prompt. You can login as user (root).
9. Similarly we can create more consoles. Isn't interesting.


Kernel is the core of the LINUX OS. It performs following functions:-
a) Device Detection:- During booting kernel detects connected devices and checks whether they are connected or not.
b)Device Driver Initialization:- After detecting connected devices kernel loads proper driver of corresponding device.
c) Mount Root File system:- It mounts root filesystem in read only mode.
d) Execute Init:- It loads and executes initial process i.e. 'init'.
e) Manage Security:- It constantly verifies filesystem permission, SELinux contexts and firewall rules.

To know about you kernal information type following command at prompt:-
uname -a (a for all info)
uname -r (r for release)
uname -s (s for kernel name)
uname -v (v for kernel version)
uname -m (m for machine name)
uname -o (o for operating system)
There are more options you can easily explore.

Protect GRUB from editing

At first I want to give you a brief intro about what GRUB is :-
GRUB (GRand Unified Bootloader) a default bootloader of LINUX.

It has two stages:-
1. The first stage is very small(446 bytes) and it resides within Master Boot Record or boot sector. It is called IPL (Initial Program Loader).
2. It Loaded from boot partition above 70MB.

Features of GRUB:-
1. Command line interface is available at boot prompt.
2. It supports ext2, ext3, fat, jfs file system.
3. It provides md5 password protection.

Now I am explaining you how you can protect grub from editing:-
a) Login at command prompt and give command grub-md5-crypt (to generate md5 password).
b) Now open grub configuration file i.e. /boot/grub/grub.conf and after the splash image add line
password --md5 md5password(copy the md5 password you get from console and paste it here.)
c) Reboot the system.
d) When the GRUB menu appears it will ask you to press p for password to unlock the menu (mainly to login as single user mode to change the root password.)

Thursday, August 20, 2009

Basic Linux

1. We can login in Linux through GUI or virtual console. We can switch to different virtual consoles by pressing Ctrl+Alt+F[1-7] keys together. We can move into any virtual consoles. (Try in Red Hat)

2. When Linux is installed the default user created is root.

3. Some basic Linux commands are:-

(a.) pwd (Present Working Directory)
for root user it will show /root
for other user it will show /home/sam (e.g. sam is user)

(b.) clear (To clear screen) or Ctrl+l

(c.) ls (Shows list of files and directories)

(d.) ls -l or ll ( Long listing of files and directories)

(e.) ls -lh ( -h is for human readable i.e. size for files or directories. )

(f.) ls -la (-a for all. lists all files and directories including hidden files)

(g.) man e.g. man ls (Manual for command along with options. Helps to get more options for command)

(h.) info e.g. info ls (Detailed information about command)
Note:- Ctr+c or Q to exit from manual page.

(i.) useradd e.g. useradd sam (Creates new user)

(j.) passwd e.g. passwd sam (Assigns password to user)

(k.) id (Print identity for the user)

(l.) who (Lists users currently logged in)

(m.) whoami (List currently logged in user)

(n.) who am i (Shows the virtual console of the current logged in user. e.g. pts pseudo terminal)

(o.) tty (Lists the terminal type)

(p.) mkdir (Creates a new directory)

(q.) rmdir (Remove directory if directory is empty)

(r.) cd .. (Takes you to previous directory)

(s.) cd . (Current directory)

(t.) rm -rf (Removes directory, files and sub directory into it. -r for recursively and f for forcefully)

(u.) userdel -r (Removes user)

Sunday, April 5, 2009

Can you undo a send mail?

You will be amazed to know that I can undo a send mail. I don't have any magic stick even you can also do that :). Gmail has a utility by which you can stop a mail from sending after hit send button.

This is important when we just send the incomplete mail just mistakenly hit the button or forget to attach the necessary files.

Please follow these steps:-
1. Login to your existing Gmail account.
2. Click on Settings option.
3. Now click on Labs tab.
4. Scroll down the page unless you find "Undo Send" option. It is almost at the bottom of the page. By default this is disabled. Enable this option.

Now when you hit the Send button you will have 5 seconds to Undo the mail to deliver to its destination. Click at the undo link will revert back to compose.