Just some of my own person Unix Notes Tips - Tricks ect...

Mounting Tips
Adding Swap Space  
Setting up Display  
Misc info Searches  
Booting/Rebooting  
Networking  
Snoop  
mount -F hsfs -o ro /dev/sr0 /cdrom
share -F nfs -o ro /cdrom      /etc/dfs/dfstab
mount -o ro,hard draft:/cdrom /cdrom
umount /cdrom
umount /cdrom
unshareall

/etc/init.d/nfs.server start
/etc/dfs/dfstab
/etc/vold.conf
mount -f forcibly unmount a file system other wise get device busy

-v print the list of mounted file systems in verbos format.

-O Allow file system to be mounted over an existing mount point making
the underlying file system inaccessible. If am mount is attempted on a
pre-existing mount point without setting this flag the mount will
fail with device busy
---------------------------------------
to mount floppy
Using volume management, type "volcheck"
To unmount using volume management, type "eject"

(the old way)
mount -F pcfs /dev/diskette /mnt
Don't forget to turn of the volume management before you try to do this from the command line
or you'll get a "device busy"

"/etc/init.d/volmgt stop" will stop the volume manager
"/etc/init.d/volmgt start" To restart the volume manager
---------------------------------------
sharing a mount remotely
/etc/rc3.d/S15nfs.server start
  this starts two deamons
---
SunOS
  rpc.mountd
  rpc.nfsd
---
Solaris
  mountd - starts mounting
  nfsd   - handles nfs traffic
----------------------------------------


swap space
/work
vi /etc/vfstab
*umount /work
comment out /work
copy c0t0d0s1
 change c0t0d0s1 to c0t0d0s7 on copy
swap -a /dev/dls/c0t0d0s7
umount swap -l
swap -a
mkfile -v 10m /tmp/disk1/myswap =makes 10 Meg swapfile in /tmp/disk
swap -s =list swap space available
swap -a /export/disk1/swapfile =add a swapfile
swap -l =list current swap devices


m64config -res 1152x900x76 now -depth 24
m64config -prconf

psrinfo -v # speed of machine and last reboot
----------------------------------------------------
To find files owned by a user, please use the following command
cd accounts
find . -user <USERLOGIN ID> -a -type f -print
ex: To find all files owned by 'stest'
find . -user stest -a -type f -print
find . -size 1000000c -ls  # look recusivly down for any file
>= to 1meg then list path.

-----------------------------------------------------
du -k | /people/strom/bin/xdu
du -k > somefile ; /people/strom/bin/xdu somefile
to check size of disk
du -ks
or df -k .
then metastat d22 (disk partition) get this off of map from Don dirks.
then format (clt0 or whatever name of slice is)
select from list of options to get info.
df -b total number of kilobytes free
/usr/xpg4/bin/df -P /usr
/usr/bin/df -F ufs -o i  # inode usage

du -k
du -a
du -ad /var | sort -nr
 - Tell big the files are in reverse oreder
----------------------------------------------------
           Undocumented Feature of FTP
                   put "| tar cf - ." filename.tar
 Description
           This undocumented feature of the "put" and "get" command from
           the FTP-System creates a tarfile of . on the fly while transferring.

           Quite useful for a fast backup to a Filesystem of a remote Host.
-----------------------------------------------
Fast alternative to cp -pr
            find . -depth | cpio -pdmv /path/tobe/copied/to
------------------------------------------------
           Find large files moved or deleted and held open by a process
             find /proc/*/fd -links 0 -type f -size +2000 -ls
 Description
           The total disk space displayed by df -k may not match the total of
           du -k for the same file system, there may have been a file that was
           deleted or moved when a running process still had it in use.

           The OS can not actually delete the file until the process has
           stopped. This command will display the file and the process id that
           you can use to stop the process. Once the process has been
           stopped the disk space will be freed.
---------------------------------------------
ps command -- Identify high cpu process

/usr/ucb/ps -auxgwwwr | head -15
Or some variation with fewer w's, missing some of the other options (the
aux is needed), using more in stead of head, and it seems the "-" before
the aux bit is optional.

ps -efo pcpu,pid,args | sort -nr | head
-------------------------------------------------
gunzip to unzip

unzip to unzip .zip files
unzip -l to look at what is in file without unziping.:
to untar
tar xvf-

to tar
tar cvf-
/usr/local/admin/bin/gzip -dc ./sunsparc-rs-405.tar.gz | tar xvf -
cannot be logged in as root.

to untar a zip file Z
gzip -dc | tar xvf-

to untar gz compressed file
zcat | tar xvf-

cat pchk_1.1.tar.Z | tar xvf -
copy directories from one location to another on same machine
tar cvf - . | (cd /u/newlocation; tar xpvf - )
Bar cvf - . | (rsh hostname "cd /usr/newlocation; bar xvf -")

bar is the same a tar works better across machines

cp -r ./source/directory ./destination/directory


sync;sync;reboot     solaris
shutdown -r          sunos
stop a
boot -r    rebuild device files
boot -s    single usr mode
---------------------------
newfs -N /dev/dsk/c0t0d0s7 ( or whatever slice)
  lists alternative super blocks to boot from.

fsck -o b=32 /dev/rdsk/c0t0d0s7 to boot from
   alternate superblock.
----------------------------------------------
Syncs File Systems and Reboots systems fast
                       /sbin/uadmin x x
 Description
           This command works well when you have to shutdown
           workstations quickly.

           /sbin/uadmin 2 6 - sync the filesystems and powers off the system
           /sbin/uadmin 2 1 - sync the filesystems and reboots to multi-user
           mode.
           /sbin/uadmin 2 3 - sync the filesystems and reboots to single-user
           mode.

           Substitute a 1 for the 2 and the system will not sync before doing
           the other actions.
----------------------------------------------


ifconfig eri0 plumb
ifconfig netmask
ifconfig broadcast
ifconifg ip
to reset interface on
ifconfig -a
ifconfig interfacename down
ifconfig interfacename up
-----------------------------------------------
route add net default 192.168.17.15 1
route add net 128.50.0.0 128.50.1.6 1 adds
 route to 128.50 network via 128.50.1.6:q
-------------------------------------------
netstat -ni to see how busy a port is, collisions, ect...
-----------------------------------


snoop -d host = watch all network packets on device host
snoop -o /tmp/mylog host =saves packets from host to file
snoop -i /tmp/mylog host1 host2 =view packets from logfile between host1 and host2
snoop -i /tmp/mylog -v -p101 =show all info on apet # 101 from logfile
snoop -i mylog -o newlog host1 =write a new log file with allhost1 packets