Introduction To Linux: Hinditron Infosystems Pvt. LTD
Introduction To Linux: Hinditron Infosystems Pvt. LTD
Introduction To Linux: Hinditron Infosystems Pvt. LTD
To create a file
[root@comp1 ~]# cat > <filename>
To append a file
[root@comp1 ~]# cat >> <filename>
To create a directory
[root@comp1 ~]# mkdir <directory name>
dd - Deletes a line
2dd - Deletes 2 lines
yy - Copy a line
2yy - Copies 2 lines
p - After deleting or copying, by pressing ‘p’ the deleted or copied
contents will be pasted below the position of cursor.
u - Undo (can undo 1000 times)
Ctrl+r - Redo
G - Moves cursor to last line of file
5G - Moves cursor to 5th line of file
User & Group Administration
• Unix/Linux is multi user and multi tasking OS
• Redhat Linux uses User Private Group (UPG) Scheme :-
– User always get created with primary group
– One Primary Group per User
• When a user is created in Linux :--
– home directory ( /home/username)
– mail account (/var/spool/mail/username)
– unique UID & GID
Type of Users
Modifying a User
[root@comp1 ~]#usermod <options> <username>
Options :
-l - Change login name
-L - Lock the account
-U - Unlock the account
Deleting a User
[root@comp1 ~]#userdel <options> <username>
Options :
-r – recursively
Creating a Group
[root@comp1 ~]#groupadd <options> <groupname>
Options :
-g - GID
-o – override
Modifying a Group
[root@comp1 ~]#groupmod <options> <groupname>
Options :
-g - GID
-o - Override
-n - To change the group name
Deleting a Group
[root@comp1 ~]#groupdel <groupname>
Group setting
[root@comp1 ~]#gpasswd <options> <groupname>
Options :
-a - add a user
-d - Delete a user from group
-M - Creating multiple members
Boot Process
Hardware Boot
• BIOS Initialization
• Performs first POST
• If all H/W connectivity is correct gives a healthy beep.
• Boot Strap Find’s the device from where to boot :-
- Floppy
- CDrom
- Harddisk
Boot Loader
• Boot Loader Initialization – Grub
Kernel
• Kernel initializes the devices
• It mounts the root file system (/)
• It start first process ‘init’ process (/sbin/init)
Init
Login Screen
To display status of all services
[root@comp1 ~]#chkconfig –list
Procedure
• Restart the system
• In the splash screen Select “RedHat Enterprise Linux”
• Press ‘e’
• Select Kernel /vmlinuz-2.6.9-5.EL ro root=LABEL=/rhgb quiet
• Press ‘e’ to edit
• Edit Kernel /vmlinuz-2.6.9-5.EL ro root=LABEL=/rhgb quiet 1
• Press ‘Enter’
• Press ‘b’ to boot with the selected run level
• directly you will get shell prompt to assign the root password
• sh-3.00#passwd root
Assigning Grub Password
[root@comp1~]# grub-md5-crypt >> /boot/grub/grub.conf
[root@comp1~]# vi /boot/grub/grub.conf
Add line in /boot/grub/grub.conf
hidden menu
password --md5 <password>
title Red Hat ------
Recovering Grub Password
• Boot the System in Rescue Mode
# chroot /mnt/sysimage
# vi /boot/grub/grub.conf
Remove line from /boot/grub/grub.conf
hidden menu
password -- md5 <password>
title Red Hat -----
To configure printer
[root@comp1~]# system-config-printer
To configure modem
[root@comp1~]# system-config-network
For IP address
[root@comp1 ~]# cd /etc/sysconfig/network-scripts
[root@comp1 ~]# vi ifcfg-eth0