Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Sunday, February 28, 2010

One of Unix Command

1.Esc :set nonu
This command is used to take off the line numbers that gets displayed in a unix program.

2.Esc :set nu
This brings back the Line numbers of the Unix program.

Monday, January 04, 2010

Unix Command on sessions

Unix command to check all the active sessions which are currently running.
ps –ef grep rts
ps : Reports the process status
-e: List information about every process now running.
-f: Generate a full listing
rts:Request To Send, RTS is a signal sent by a communications device, such as a modem, to verify if the other device is ready for data to be sent to it.

If you have some issues in unix for example like “license on the server expired”, by giving the above command you can find all the active sessions running on that server.So by killing all the unused or expired sessions your issue may be resolved.Command to kill the session
kill %pid
Kill: cancels a job
Pid-A job control job ID that identifies a background process group to be signaled.

Saturday, December 20, 2008

Search a User By name & get his ID on Unix

#! /usr/bin/sh
echo "Enter User Name to be Searched"
read USERNAME
NAMES=`who awk {'print $1'} sort -u`

for NAME in $NAMES
do
USER=`finger $NAMEgrep $USERNAME awk {'print $7,$8'}`
if [ "$USER" != "" ]
then
echo $USER ——- $NAME
fi
done

Wednesday, December 17, 2008

Searching lines before & After in Unix

#! /usr/bin/sh
#———————————————–
#Program used to search a seed in a program
#———————————————–

SEED=$1
LINE=$2
FILE1=$3


for X in `awk '/'"$SEED"'/{ print NR }' $FILE1 `
do
echo ———————– $SEED ————————————–
NOB=`expr $X - $LINE`
NOA=`expr $X + $LINE`

if [ $NOB -lt 1 ]; then NOB=1
fi
for J in `awk 'NR == '"$NOB"',NR == '"$NOA"'
{
if(NF!=0) print; else print "\n"
}' $FILE1 `

do
echo $J
done
echo ——————————————————————-
done
Computers Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory