Sunday 11 November 2012



To check  any type of process status and to count the no of process are currently running :-
#!/bin/bash
echo "To  check any type of processe status"
ps aux | grep $1 | grep -v "\(root\|grep\)" | wc -l

Run it by following command :-
sh cntproc.sh "process name"
examaple:- [root@localhost scriptexamples.sh]# sh cntproc.sh  sendmail
To count the currently how many apache processes are  running
1



All Service Status


To check all Service Status:-
#!/bin/bash
echo "To check status of all services are running or not "
service --status-all|grep "\(run\)"
service --status-all|grep "\(not run\)"
sh allservstatus.sh |awk '{ print $1 }'

Monday 5 November 2012


To  check   user account is lock or not:-
First create user account by using following command:-
Useradd username
Passwd  “password”

Example:-

 [root@linuxnotes~]# useradd swapnil

[root@linuxnotes~]# passwd swapnil

 Changing password for user swapnil.
 New password:*******
 BAD PASSWORD: it is based on a dictionary word
 BAD PASSWORD: is too simple
 Retype new password:********
 passwd: all authentication tokens updated successfully.

 [root@linuxnotes~]#

 Command to lock user account :-

[root@linuxnotes~]# passwd -l swapnil
Locking password for user swapnil.
passwd: Success

To test useraccount is lock or not :-
login as: swapnil
swapnil@linuxnotes.co.in password:
Access denied
swapnil@linuxnotes.co.in password:

To unlock the useraccount:-
[root@linuxnotes~]# passwd -u swapnil
Unlocking password for user swapnil.
passwd: Success
[root@linuxnotes~]#

**Note:- Any type of changes in linux you should login by useraccount root.

 .