1. Userdefined Command
#vi thanks (a new file)
echo “Welcome To Computer World”
:x
#chmod 777 thanks
/root # thanks à (it will work)
/root $ thanks à (it will work)
2. Run Script
K= Kill script
S = Start script
Generally we work on run level 3. So, we use ntsysv command for kill or start of any service. Such as-
(i) #ntsysv
[ ] sendmail
(ii) #cd /etc/rc.d/rc3.d
#mv S80Sendmail K30Sendmail
(iii) #vi /etc/rc.d/rc3.d/S60thanks
ifconfig eth0 down
:x |
(It will at the time of boot)
#service sendmail restart
or
#/etc/init.d/sendmail restart
*For start/stop or restart any service:
#/etc/init.d/(servicename) start or stop or restart
3. Fdisk-Partition table manipulation for Linux adding/removing/changing partition(s)
#fdisk 1 (show partitions of hard disk)
#df –h (report file system disk spau uses)
* adding/removing/changing partition.
#fdisk /dev/had or sda
Now we will get :
Command (m for help): m --
Show details about some command.
Such as- p, d, t, m, w, q, l, n etc when we have to use.
P - for print partition
n - for creating new partition
d - for deleting partition
t - for changing a partition system ID
m -for help
l - for list known partition ID/type
q - for quit without saving change
w - for write to the disk (after creating or changing partition)
After adding/removing/changing partition(s) we have to reboot the pc and create file system and write on /etc/fstab file if required.
If you create ext3/swap/fat32 partition(s), you must use following command for format partition(s)-
#mkfs.ext3 /dev/hda n - (linux ext3)
#mkswap /dev/hda n - (linux swap)
#mkfs.vfat /dev/hda n - (windows fat32)
Note: - here “n” for number of partition.
4. Proc file system
This is not a true file system, it is really an interface into the currently running kernels data structures. The proc file system is usually mounted in the /proc directory in Linux. See Cpu info, meminfo, pci etc files under the /proc directory.
#cd /proc
#vi cpuinfo
#vi meminfo
*Alt+Ctrl+Del:
Disabling “Alt+Ctrl+Del” for rebooting you have to modify /etc/inittab file. To activate this file you have to either reboot the pc or type init q from # prompt.
5. Use of “alias” command
Temporary:-
For current log in:
#alias n= “service xinetd restart” .
Type any command
#n (Now xinetd service must be restarted.)
Permanently:-
For root: -
#vi /root/.bashrc
#.bashrc
# User specific aliases and functions
alias n= “service named restart”
#source global definitions
For user: -
$vi /home/toy/.bashrc
Username
#.bashrc
#user specific aliases and functions
alias n= “service httpd restart”
Type any command.
#source global definitions
6. Linux Rescue
After setup windows Xp we cannot get Linux. In this case we have to follow the following rules. (If Linux is available in hard disk): -
1. Boot from cd of Linux
Boot: Linux rescue
Type this
2. next/continue/ok/yes
|
N
3. #chroot /mnt/sysimage -
4. #fdisk –l -
5. #grub-install /dev/sda or hda -
6. #reboot -
If is available whether lilo/grob is default.
File /boot/grub/grub.conf
*If we create or delete any partition, we must get problem in Linux boot loader. In this case we have to follow the following rules: -
1. Linux Rescue
2. #chroot /mnt/sysimage
3. #fdisk -l
4. #vi /etc/fstab
*The partition of this file should be the same as the partition number of swap in hard disk.
5. #vi /boot/grub/grub.conf
*For this file, the partition number should be less in one number in boot loader than the partition number of “/” in hard disk.
6. #grub-install /dev/sda or hda
7. #reboot -
No comments:
Post a Comment