Monday, December 31, 2007

How to view the time that it takes for a packet to cross the network

# ping -s (ip)

how to change a timestamp on a file?

# passwd -n 14 -x 84 -w 14 (file)

How to duplicate a drive--diskdup

# dd if =/dev/rdsk/(input file ex. c1t1d0s2) of= /dev/rdsk/(outputfile ex.c1t2d0s2) bs=64k

How to sort largest files first

# du -adsk | sort -rn | more

How to see if the account is locked in Nis

If you are running nis or nis+ and want to see if a user is locked out

do

# niscat passwd.org_dir | grep -i (user name)

To check CPU utilization

log on to the system

# su -

/usr/ucb/ps -aux | more

./ps -aux | more

how to bring up another xterm

# /usr/openwin/bin/xterm &


do a # which xterm to find your path, but most should be the above.

how to eject a tape

# mt -f /dev/rmt/0 offline

or
# mt -f off works also

Saturday, December 29, 2007

some system checks

The first thing I do when I take over a new system , is write a check script.
You can check several things and tailor it to your system, but here are a few to get you started:

check for users and groups that are equal with root

# grep ':00*:' /etc/passwd

check for invalid passwords
# grep invalid /usr/adm/syslog

list the last 20 logins

# last | head -20


#/usr/platform/sun4u (uname -n)/sbin/prtdiag -v

will show you useful hardware information.

#df -k -F ufs

will show you only local disks , and show you the total space used space, and free space


#/usr/sbin/psrinfo -v

will show you the cpus adn their speed.

see how many users are logged in

ps -ef | awk `{print $1}` | sort|uniq| wc -l

sort largest files first

# du -adsk | sort -rn | more

global replace in vi

nice bit of information , although who uses vi any more ? gvim, nedit maybe.

# : / $ s /(search for this)/( replace with this) / g

Friday, December 28, 2007

zero out a file

most sysadmins know this , but I am not sure who my audience is going to be yet.

anyway in order to zero out a file ...wtmp for example

cat /dev/null > wtmp (filename)

send an xterm

often in my business I have to tell customers to send me an xterm.

here is how

/usr/openwin/bin/xterm -display (ip):0.0 &

only second column of /etc/hosts

just a quick one to get things started
a command to look at only the second column(ie host names) in the /etc/ hosts file?

more /etc/hosts | awk `{print $2}`