note: most of these commands are for HP-UX
things to do with awkcheck user id's and home directoriescat /etc/passwd | awk -F: '{print $3" " $6}' | sort > sorted.pass.3.6sort a password file in NIScat /var/yp/passwd | awk -F: '{print $3" "$6" "$1}' | sortlook for a process and kill it
# looking for specific string in process, e.g. dial (from a failed ppp)
ps -ef | grep dial | awk '{print "kill " $2}'
IF IN A SCRIPT (pass it via a file):
ps -ef | grep dial | awk '{print "kill " $2}' > /tmp/killproc
sh /tmp/killproc
SET DISPLAY in .profile (tested on Sun and HP)
who am i -R | tr -d [\(-\)] | awk '{print $NF}' | grep -v :0 | \
awk '{print "export DISPLAY="$1 ":0"}' > /tmp/setdisplay
. /tmp/setdisplay
/usr/bin/env | grep DISPLAY
NOTE: ALWAYs look at Display setting, especially if you're moving
around and logging in and through other systems! When using xterm
or other GUI tools, always launch with an ampersand (&) at the end
so you're able to kill it from jobs. (jobs lists the processes
running in the background, kill %# - #=job number)
(HP-UX 11i on an 800 series wanted env fully resolved /usr/bin/env)
test login against current userid
if [ `who am i | awk '{print $1}'`=`whoami`]
then
blah;blah
exit;exit
fi
more real life examples
to change user "luser"'s group from "lgroup" to "othergrp"
-----------------------------------------------------
root@server [/home/files]
ll | grep luser | grep lgroup | awk '{print "chown luser:othergp" " " $9}' > list
chmod 700 list
./list
test to force an su login
case `/usr/bin/who am i | awk '{ print $1 }'` in
userid) if [ `/usr/bin/who am i | awk '{ print $1 }'` = `/usr/bin/whoami` ]
then
echo "################no#login#########################"
exit;exit
fi;;
esac
NOTE: userid is login name that can not login directly
root-#->HOW-TO-CLEAR-A-USER
# handy way to clear dead sessions and ALL activities of a user
# or a process. Puts the kill on each line.
#
# ps -ef | grep userid > nuke.userid
# cat nuke.userid | awk '{ print "kill -9 " $2 }' > nuke
# more nuke
# sh nuke
# w
|
|
Select pages from WAGONEERS.COM:
Buy this FSJ decal... ...use PayPal to pay for it! |
AMSOIL synthetic lubricants and filters (please use customer #283461)
Shop AMAZON.com from wagoneers.com!
| |||||||
|
these pages protected by US Copyright laws John Meister copyright © 1995-2001 all rights reserved contact john-at-wagoneers.com | "Join the fight against spam (UCE)! Eliminate spam!" |
Washington State has a $500 fine for "spam" (unsolicited commercial email)! |