Operating System - HP-UX
1833156 Members
3291 Online
110051 Solutions
New Discussion

Submit Very Basic System administration commands and win easily points

 
SOLVED
Go to solution
Jeff Schussele
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

To convert a system to trusted mode

/usr/lbin/tsconvert -c

To convert trusted back to non-trusted

/usr/lbin/tsconvert -r

To preserve PWs after conversion to trusted - obtain a list of user names using any method you desire & write it to a file - say userlist - Then

for NAME in userlist
do
/usr/lbin/modprpw -V $NAME
done

Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
John Carr_2
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

Hi
to checkout the error log file without using an editor use command "dmesg" next time use command "dmesg -" and it will tell you only about errors which have happened since last time "dmesg -" was executed.

John.
Shannon Petry
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

Safe binary copy of directory tree from /1a to /2a
$ cd /1a
$ find . -depth -print|cpio -padlmuxv /2a
#!/bin/sh
#Mangle user
USER=john
I=1
while [ "$I" -lt "2" ] ; do
/bin/kill -9 `ps -ef | grep $USER | grep -v grep | awk '{print $2}'`
sleep 300
done

I actually have a network version of mangle user which runs through a host list and kills user processes every 5 minutes.
The strange things sysadmin do to get even with users! hehe

Microsoft. When do you want a virus today?
Trevor Dyson
Trusted Contributor

Re: Submit Very Basic System administration commands and win easily points

Replace /dev/rmt/0m with /dev/null to dramatically improve backup performance ;-)
I've got a little black book with me poems in
Trevor Dyson
Trusted Contributor

Re: Submit Very Basic System administration commands and win easily points

OK now here is a serious one:

Use

swverify '*'

to check ownership, permissions, checksum and so on for all software and patches installed with swinstall.

Use

swverify product_name

to check an individual product, eg perl.

Use

swverify -F product_name

to fix any file attributes found to be out of order for an individual product.
I've got a little black book with me poems in
Albert Smith_1
Regular Advisor

Re: Submit Very Basic System administration commands and win easily points

Extending filesystems with online jfs

lvextend -L filesystem size in mb /dev/vgxx/lvolxx

fsadm -F vxfs -b filesystem size in mb x 1024 /mount point

Sandman!
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

Helpful script that collects diagnostic information and e-mails you:

# echo "selall;info;wait;infolog;view;done" | cstm | mailx -s "CSTM Info"

Swap devices and current virtual memory usage:

# swapinfo -tm

Quick look at system load averages:

# uptime

Number of processors in use:

# echo "runningprocs/D" | adb /stand/vmunix /dev/mem

Processor speed:

# echo itick_per_usec/D | adb /stand/vmunix /dev/mem

Defragmenting a filesystem (OnlineJFS only):

# fsadm -F vxfs -d -D -e -E
Geoff Wild
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

Wow - this is an old thread...

How about sendmail version:

echo \$Z | /usr/sbin/sendmail -bt -d |grep Version


And bind version:

dig @yourserver version.bind chaos txt

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Mahesh Kumar Malik
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

Hi Santhosh

Few contributions from my side to your excellent way of building COOK BOOK:

1. To know whether kernel is 32 bits or 64 bits

#getconf KERNEL_BITS

2. To know my login name

#who am i

3. To check status of Fiber Channel HBA

#fcmsutil /dev/

4. To check no of CPUs installed, system processes and memory used by them

#top

5. To shrink size of a log file to zero

# cat /dev/null >

Regards
Mahesh
Fedon Kadifeli
Super Advisor

Re: Submit Very Basic System administration commands and win easily points

Some from me:

============================================

[1] Find the process which uses the most CPU during the last scheduling interval:

UNIX95= /bin/ps -eo pcpu,pid,comm | \
sort -n | tail -1

============================================

[2] Use the "pstre" (http://hpux.connect.org.uk/hppd/hpux/Users/pstre-2.11/) command for graphical list of processes of a "process branch." For example:

pstre -p 21476

============================================

[3] Use shell features to split a line into fields:

grep root /etc/passwd | IFS=: read user x1 \
uid gid x2 home shell
print $uid $home

============================================

[4] Use "mt offl" to unload a tape from /dev/rmt/0m. There is no reverse command for this!

============================================

[5] Use [] in grep to find the process and not include the grep command itself when you pipe "ps -ef" output to grep:

ps -ef | grep inet[d]
instead of
ps -ef | grep inetd

============================================

[6] Use the following function to find the "age" of a file:

function file_age {
/usr/contrib/bin/perl -e '
$mtime = (stat('"'"$1"'"'))[9];
$age = ($mtime) ? time - $mtime : -1;
print $age;'
} # file_age

For example:

file_age /etc/passwd

will return the number of seconds passed since /etc/passwd was updated.

Note: The characters after stat read as follows: single quote, double quote, single quote, double quote, dollar, one, double quote, single quote, double quote, single quote, closing parenthesis, etc.

============================================

[6] Use the "lsof" command (http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.74/) to List files, sockets, etc opened by processes. Very handy!
mirco_1
Valued Contributor

Re: Submit Very Basic System administration commands and win easily points

hy,

stop the system ==> stop the problem :-)

shutdown -h 0

DM.
Ronaldinho
Advisor

Re: Submit Very Basic System administration commands and win easily points

show me the points!!!
find / -name (file you are looking for)
Coolmar
Esteemed Contributor

Re: Submit Very Basic System administration commands and win easily points

"find" command uses:

Find and delete files older than 7 days:

find / -type f -mtime +7 -exec rm -rf {} \;

Find all files over 2MB:

find / +2000000c

Find all files containing a certain string:

find / -exec \grep -li STRING {} \;

TwoProc
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

... shrink size of a log file to zero
(even shorter)

# :>
We are the people our parents warned us about --Jimmy Buffett