Posts

Showing posts from April, 2011

Starting and Stopping Services

1. To start http service : # /etc/rc.d/init.d/httpd start # service sshd start 2. To stop http service : # /etc/rc.d/init.d/httpd stop # service sshd stop 3. To restartp http service : # /etc/rc.d/init.d/httpd restart # service sshd restart 4. To show the status of http service : # /etc/rc.d/init.d/httpd status # service sshd status 5. To show the status of all the services : # service --status-all 6. To list the state of a service in different run levels : # chkconfig --list ypxfrd 7. To list the state of all the services in different run levels : # chkconfig --list 8. To enable SSH service in run levels 2,3 and 4 : # chkconfig --level 234 sshd on 9. To disable SSH service in run levels 2,3 and 4 : # chkconfig --level 234 sshd off

Swap Space

1. To setup swap space on a newly created partition : # mkswap /dev/sdb3 2. To enable the swap partition : # swapon /dev/sdb3 3. To enable the above swap device at boot time, add the below line to /etc/fstab /dev/sdb3 swap swap defaults 0 0 4 To create a swap file: a. Create an empty file # dd if=/dev/zero of=/swapfile bs=1024 count=65536 b. Create swap space on the file # mkswap /swap-file c. Enable the swap file # swapon /swap-file d. Add the below line to /etc/fstab /swap-file swap swap defaults 0 0 5. To remove a swap file a. Disable swap on the file # rmswap /swap-file b. Remove the corresponding entry in /etc/fstab c. Delete the file # rm /swap-file