Skip to content

TRU64 Command CheatSheet | Ngelinux

Posted from: https://ngelinux.com/tru64-command-cheatsheet/

1. System Version

sizer -v

2. Unix Name and hostname

uname -n; uname -a

3. Number of CPU(s)

sizer -p

4. Memory state

vmstat -P

5. Swap state

swapon -s

6. Filesystems

df -k
df -k -t advfs

7. CPU numbers, speed

# * Number of CPUs with psrinfo
psrinfo -n

# * Number of CPUs with sizer
sizer -p

# * Number of CPUs with dbx (debugger)
echo "p ncpus" | dbx -k /vmunix /dev/mem 2>/dev/null | tail -1
echo "p rpb->rpb_numprocs" | dbx -k /vmunix /dev/mem 2>/dev/null | tail -1

# * CPUs type with psrinfo (speed, model, cache)
psrinfo -v

# * CPUs type with hwmgr (only for version 5)
hwmgr get attr -cat cpu -a sub_category
hwmgr get attr -cat cpu -a sub_category -a speed

# * CPUs speed (MHz) with dbx (see also "rpb" and "rpb -r" with kdbx)
SPD=$(echo "pd rpb->rpb_counter/1000000;quit" | dbx -k /vmunix /dev/mem 2>/dev/null | tail -1)
echo "CPU SPEED = ${SPD}"

8. System Type

# * System Type (only for version 5)
SYS_TYPE=$(hwmgr get attr -cat platform -a name | grep -v : |sed 's/  name = //')
echo "${SYS_TYPE}"

# * System Type with kdbx (kernel debugger)
KERN=$(sizer -b)
SYS_TYPE=$(echo sum | kdbx -k /${KERN} /dev/mem | grep cpu
SYS_TYPE=$(echo "${SYS_TYPE}" | cut -f2 -d: | cut -f1 | cut -b2-)
echo "${SYS_TYPE}"

# * System type with dbx
KERN=$(sizer -b)
STR="pd (char *)rpb + rpb->rpb_dsr_off + ((struct rpb_dsr *)\
     ((char *)rpb + rpb->rpb_dsr_off))->rpb_sysname_off + sizeof(long)"
SYS_TYPE=$(echo "${STR}" | dbx -k /${KERN} /dev/mem 2>/dev/null | tail -1 | cut -f2 -d'"')
echo "${SYS_TYPE}"

# * System Type with snmp_request (SNMP query)
COM=$(grep ^community /etc/snmpd.conf | tail -1 | awk '{print $2}')
snmp_request 127.0.0.1 ${COM:-public} get 1.3.6.1.2.1.1.1.0

9. Patches and installed software: “setld” e “dupatch”

# * Patch Kit summary
dupatch -track -type kit -nolog#

# * Manual Patches
dupatch -track -type patch -nolog | grep "Patch C"

# * Delete a list of patches  (divided by product: UNIX and Cluster)
dupatch -delete -product Tru64_UNIX_V5.1B -patch "C 00362.02" "C 00926.00" "C 00927.00" \
"C 00469.00" "C 00564.02" "C 00453.00" "C 00407.00" "C 00409.01" \
-product TruCluster_V5.1B -patch "C 00127.00" -name "HP" -note "delete manual patches PK3 from the cluster"

# * Patches/Package dependences
cd /usr/.smdb.; /usr/lbin/depord -I package_name

# * Truly "active" Patches
grep -v none /usr/.smdb./OSFPAT*.inv | awk '{print $1}' | sort -u | cut -f1 -d:

# * Software/patches installed
ls /usr/cluster/members/{memb}/.smdb.

# or (like manpages says)
ls /usr/.smdb./*.lk

10. Verify that permissions owners of “files” installed on the system are:

#   correct and with a valid checksum (see also: manpage fverify)
ls -l ls /usr/.smdb./*.lk | sed 's/lk/inv/' | while read F; do /usr/lbin/fverify -np <$F; done 2>&1

11. Last PatckKit (PK) Installed

#   (dupath -track -type kit -nolog -> is the same, but slower)
PATCH=$(grep AS0 /var/adm/patch/log/event.log | cut -f2 -d'>' | cut -b2- | tail -1)
expr ${PATCH##*AS%%-*}

# * Baseline (in version 4.0g there isn't)
grep AS0 /var/adm/patch/log/event.log | cut -f2 -d'>' | cut -b2- | tail -1 |\
awk -F"AS" '{print $1}' | rev | cut -b -3 | rev

# * Manual Patch (by hand)
grep ^KITNAME /var/adm/patch/log/event.log | grep -v AS | cut -f2 -d'>' |\
cut -b2- | sort -u

# * Manual Patch only for the last PatchKit
BN=$(grep AS0 /var/adm/patch/log/event.log | cut -f2 -d'>' | cut -b2- | tail -1 |\
     awk -F"AS" '{print $1}' | rev | cut -b -3 | rev)
grep ^KITNAME /var/adm/patch/log/event.log | grep -v AS | cut -f2 -d'>' | cut -b2- |\
sort -u | grep $BN | tr '\n' ',' | sed s/,$//

12. Users

# NOTES: see the manpage of: "usermod"
#        some commands are only valid for system with C2
#        (Security ENHANCHE - "rcmgr get SECURITY")
#
# Unlock a User
usermod -x administrative_lock_applied=0 username

# Lock a User
usermod -x administrative_lock_applied=1 username

# * Enable a user when he is in DISABLE state
#   In "10" days the user must login
usermod -x grace_limit=10 username

# * Enforce user password change
usermod -x passwd_must_change=1 username

# * Get/Query user status
passwd -q username
passwd -qa # -> all users (LK=Lock, PS=OK, NP=no password)

# * Change HASH field to "*" like shadow password
sed 's/:[^:]*:/:*:/' /etc/passwd

13. C2 (Security ENHANCHED)

# * Is the system in C2 (Security ENHANCHED)
rcmgr get SECURITY

# * Delete all users from SIA db (C2 db) that are not present in "/etc/passwd"
/tcb/bin/authck -p
convuser -d

# * Some Checks
grpck
pwck
siacfg
ckfsec

# * Editing of the default values of SIA DB
#   (edauth may be located at: "/tcb/bin/edauth")
VISUAL=/usr/bin/vi edauth -dd default
VISUAL=/usr/bin/vi edauth username

# * Get/Show user "C2" attributes
edauth -g username
edauth -g # show all users

# * Get/Show default values
edauth -g -dd default

# NOTES: see prppasswd, default manpages

14. Filesystem/Files

# * Show files in "size" order
cd /; find . -mount -type f -exec du -k {} \; | tee /tmp/df1
sort -rn /tmp/df1 | tee /tmp/df2; mv /tmp/df2 /tmp/df1
more /tmp/df1

15. Advance Filesystem (AdvFS)

# Under the path: "/sbin/advfs/"; there are AdvFS utility
#
# * Repopulate "/etc/fdmns".
#   May be useful when you do a storage migration.
#   Ex. - All disks of storage 'A' will be migrated to a storage 'B'.
#   (see manpage of advscan)
/sbin/advfs/advscan -ga
/sbin/advfs/advscan -g
/sbin/advfs/advscan dsk101
/sbin/advfs/advscan -g dsk101

# For the real fix be carefull (pay ATTENTION!)
/sbin/advfs/advscan -r
/sbin/advfs/advscan -f domain_name

# * Files in ".tags" directory (.tags files)
#
#   tag 1 is th fragment file.
#   (the biggers is, worst in performance)
cd /mount_point/.tags
ls -li 1                                # Check the size of frag file
showfile -x 1 | grep -i extentcnt       # Check number of extent

# * Disable frag file
#   [ With this operation files will be create with a size that is a
#    multiply of 8192 (8KB). A file of 100 byte will reserve 8KB
#    The file "/mount_point/.tags/1";
#    handle all "pieces" of small files, this to use at best the
#    Filesystem space ]
chfsets -o nofrag fset_name            # Disable frag file

# * BMT file (Bitfile Metadata Table -> Metadata)
#   The BMT is M-10
#   AdvFS volumes begin from M-6 and increment by a factor of six
#   (M-6, M-12, M-18, ...)
cd /mount_point/.tags
showfdmn domin_name                       # How many disks
ls -ls      M-6 M-12 M-18 M-24 M-30 M-36  # Check the size (ex. 6 dsks)
showfile -x M-6 M-12 M-18 M-24 M-30 M-36  | grep -i extentcnt # Check extent
showfile -x M-10 # Check extent of BMT

# If BMT (M-10) is too much "fragmented" you may create a new FS with
# different values.
# -p (the initial size of BMT)
# -x (size of extent for BMT)

# * AdvFS statistics and Buffer cache
advfsstat -b           # Buffer cache
advfsstat -l   0       # Lock stats     basic
               1       #                detailed
               2       #                very detailed

advfsstat -v   2       #
advfsstat -v   3       #

16. How to create a particular AdvFS Filesystem

mkfdmn -p 256000 -x 4096 dsk69c particular_domain

# It will take a lot, because it will create 256000 pages of 8192 (or 8184) bytes
# 2 GByte of preallocate bitfile metadata table.
#
# * How to Increment AdvFS performance
vfast -o defragment=enable,balance=enable,topIObalance=enable my_domain
vfast status my_domain

17. Defragment of AdvFS

# Show defragment status of domain/Filesystem
defragment -nv my_domain

# *  Defragment for 30 minutes
#    with -T "exactly" of 30 minutes (it is not true at all ...)
defragment -t 30 -v my_domain

# *  Defragment of ALL domains (in parallel) for 30 minutes
defragcron -T 30 -p

8. Kernel parameters (sysconfig)

# * List of dynamic subsytems loaded during boot
/sbin/init.d/autosysconfig list

# * List of subsytems (dynamic and static) loaded and configured
sysconfig -s

# * List of subsytem sorted by: dynamic and static
sysconfig -m

# * Load a dynamic kernel module onto the system (ex envmon)
sysconfig -c subsys

# * Unconfigur a dynamic kernel module
sysconfig -u sybsys

# * Set automatic load of a dynamic kernel module at boot
#   ATTENTION (use sysconfig -c subsys)
#   See: SUBSYSTEM_LIST in "/sbin/init.d/autosysconfig"
/sbin/init.d/autosysconfig add subsys

# * Delete automatic load of a kernel module at boot
/sbin/init.d/autosysconfig delete subsys

# * Get/Query kernel parameters
sysconfig -q subsys [parameter1] [parameter2] ...

# * Get/Query configurable values of a kernel parameter/s
sysconfig -Q subsys [parameter1] [parameter2] ...

# Meaning:
#             type=?    typp: INT, UINT, LONG, ULONG e STRING 
#             op=?      Opertions:
#                       C = Configurable (if there isn't R -> needs reboot)
#                       R = Configurable at Runtime;
#                       Q = Query
#             min_val=? min value
#             max_val=? max value
#
# * Get/Query a kernel parameters stored in: "/etc/sysconfigtab"
sysconfig -d subsys [parameter1] [parameter2] ...

# * Get/Query a kernel parameters stored in: "/etc/sysconfigtab"
sysconfigdb -l [subsys]

# * Set/Modify a Runtime kernel parameter
sysconfig -r sybsys parameter=value

# * Manpage of a specific subsystem (for kernel parameters)
man sys_attr_subsys

# * Notes:
#   - When you load subsys lag (man lag) you can't do the unconfigure
#   - To make static a dynamic module you need to rebuild de kernel
#     Modify by hand configuration file (section options) see: doconfig
#   - To make permanent the value of a parameter after a reboot, you must
#     edit the file: "/etc/sysconfigtab" (pay Attention!)
#     Manpages suggests to use: "sysconfigdb"
#   - On a cluster keep parameters in sync (...with some exceptions)

19. SNMP Simple Network Management Protocol

# * Information of the system: "SYSTEM" with COMMUNITY "public"
#   Change "public" if you have a variant (see: "/etc/snmpd.conf")
snmp_request SYSTEM public get 1.3.6.1.2.1.1.1.0

20. Show Firmware firmware version

snmp_request SYSTEM public get 1.3.6.1.4.1.36.2.18.22.1.2.10.1.3.1

21. Event Management (evm)

evmget | evmsort | evmshow -T "%Y/%m/%d %T " -t "[@priority]  @@" | more

22. System Temperature

# Load kernel module if not present (see sysconfig tips)
# (sysconfig -c envmon; sysconfig -q envmon; sysconfig -u envmon)
sysconfig -q envmon

23. Cluster and cluster alias

# * Cluster status
clu_get_info -raw

# (version 4)
cnxshow

# * Cluster alias information
cluamgr -s all # -> Configuration
cluamgr -a alias=alias_name,leave,rpri=0 # -> Disable an alias
clua_active alias_name # -> 0 if active, 1 otherwise
cluamgr -r start # -> Restart of alias routing
cluamgr -r info # -> Show some more information (Not documented!!!)

# * Cluster Alias Bilanced connections
cluamgr -a selp=10,rpri=10,alias=DEFAULTALIAS  

# this on node two
cluamgr -a selp=5,rpri=5,alias=DEFAULTALIAS

# (cluamgr -a selw=3,selp=10,rpri=5,join,alias=DEFAULTALIAS)
# Service in "/etc/clua_services" must be in_multi

# * Configuration of a single member
#   See: directory /.local.. -> cluster/members/{memb}

24. Memory channel (MC)

# * Show members of a cluster orderd by ID (versione 4.x)
cnxshow
cnxshow -v
cnxshow | tail +10 | cut -f1 -d' '

# * Kernel parameters for the Memory Channel
sysconfig -q rm
(see: rm_errors, rm_shutdowns - and manpage: sys_attrs_rm)

- Filesystem relocation on a cluster (cfsmgr)
cfsmgr -a SERVER=${HOSTNAME} -d ${D}
# where: HOSTNAME=is_the_host_name and D=domain_name
cfsmgr -h host2 -r -a SERVER=host1 /my_fs
# move: "/my_fs" from host2 to host1

# * Show FileSystems status (raw output)
cfsmgr -F raw

25. Network (net)

# * With "trailers" option you will increment performance (see manpage: ifconfig)
#   but not all routers support this option. (PAY ATTENTION!)
ifconfig ee0 10.41.8.221 netmask 255.255.255.0 filter trailers

# * Switch of a interaece in NetRain (trunking) config
ifconfig ee1 switch # if Netrain is made by: ee0, ee1 (ee0 UP); switch ee0 to ee1

# * IP down (to create a netrain, interfaces must be without IP)
ifconfig ee0 down delete abort

# * Get/Show IP aliases
#   Tru64 v5 "ifconfig" will show
#   Tru64 v4 use instead "netstat -in"
ifconfig ee0
netstat -in | grep ee0 | awk '{print $4}' | tail +3

# * Get/Show all network interfaces
ifconfig -a

# * Get/Show routing table
netstat -nr

# * Set media speed of a network interfaces
lan_config -i ee0 -s 100 -x 1

26. Remote Procedure Call (RPC)

# * Get/Show all port associated with rpc
rpcinfo -p

# See: man portmap (port 111); man inetd (on 5.1B)
# * Get/Show connected users "rpc.rusersd"
rusers -al

# * Get/Show systems state: uptime, load; "rpc.statd"
#   (will do a broadcast on the net)
rup
ruptime

# * Send a message to all the network (like: wall) "rpc.rwalld"
rwall
rwall hostname
shutdown -b # (broadcast to say: i will reboot soon)

# * Test rpc "rpc.sprayd"
spray # (see: man spray)

27. LSM change fault disk

# (is the same also for version 5)
voldisk list
voldg -g dg-1 -k rmdisk rzh69
voldisk rm rzh69
disklabel -z rzh69
disklabel -rw rzh69 auto
voldisksetup -i rzh69 privlen=1024 nconfig=1 # privlen may change (5 use 4096)
voldg -g dg-1 -k adddisk rzh69=rzh69
volrecover -sb rzh69
iostat rz43 1
volprint -Aht | grep wo

- disklabel export (disklabel cloning)
disklabel -r dsk35 > /tmp/dsk35
disklabel -Rr dsk39 /tmp/dsk35

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version