Operating System - HP-UX
1833458 Members
3378 Online
110052 Solutions
New Discussion

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

 
SOLVED
Go to solution
Glenn L. Stewart
Frequent Advisor

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

A very handy one....

Finding the bytes in a directory (not including directories below).

For example

/dir1/dir2
/dir1/dir2/dirx
/dir1/dir2/diry

To find size of /dir/dir2 (including dirx,diry)

from /dir1/dir2
# du -ks .

BUT

To find size of /dir1/dir2 (excluding dirx,diry)

from /dir1/dir2
# ls -l | tr -s " " ""|cut -d" " -f5|xargs echo|sed "s/ / + /g"|bc

(Cut and paste above from browser)

Glenn
Mark van Hassel
Respected Contributor

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

Check consistency of passwd, group and authentication database:

pwck
grpck
authck
The surest sign that life exists elsewhere in the universe is that none of it has tried to contact us
Mark van Hassel
Respected Contributor

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

To get detailed info from patches on HPUX11:

swlist -l patch -a size -a description -a state -a superseeded by
The surest sign that life exists elsewhere in the universe is that none of it has tried to contact us
discoverer
Frequent Advisor

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

To W/S beginners: conquer your W/S!

=================================
1.phenomena
* can't login the W/S
* the system is slow
* can't start some applications
* some commands run incorrectly
......

2.issues analysis
Most of the issues are due to the following reasons:
1. your local envioronment settings
2. the disk quota of your account
3. the CPU/memory usage
4. the network flood
......

3.actions
1. check your local '.*' envioronment files:
backup your cshrc & .login or .profile;
then copy .cshrc & .login or .profile from /etc/skel to your HOME directory;
then test again.

if the issue disappears, there must be something wrong with your above '.*' files, just correct them.

Note: some common environment variables
* csh:
setenv TERM xterm
setenv EDITOR vi
setenv PATH $PATH:/applications/bin (note: pls add such a line in .login, but not in .chsrc)

setenv LPDEST lj5si3 (note: set lj5si3 as the default printer)
setenv LANG C or setenv LANG zh_CN.hp15CN
* sh:
TERM=xterm
export export
EDITOR=vi
export EDITOR
PATH=$PATH:/applications/bin (note: pls add such a line in .login, but not in .chsrc)
export EDITOR

LPDEST=lj5si3 (note: set lj5si3 as the default printer)
export LPDEST
LANG=C or LANG=zh_CN.hp15CN
export LANG

2. decrease your disk space usage: (especially when you can login your W/S but soon return to the login screen automatically)
in your W/S, or use other machine to telnet to your W/S:
/usr/bin/quota -v your_account (more info pls refer to 'man quota')

if your usage beyonds the quota, pls delete enough unnecessary files to solve the issue.

3. 'EXIT'
save your work, then click 'EXIT' on the CDE windows manager to logout

4. kill -9 -1 (especially for some system or application issue)
save your work, then use kill -9 -1 to kill all YOUR processes running on your W/S

5. mv ~/.dt and login again (for CDE login issues)

6. shutdown (especially for some system or network issue)
Listen, then discover, then succeed!
Paula J Frazer-Campbell
Honored Contributor

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

Hi
Command to get rid of users who have done nothing for more than an hour.

who -u | egrep " [1-9]:" | grep -v root | awk '{print $7}' | xargs kill

Use grep -v to excluse certain users from this tidy up routine.

Change the 1-9 to 2-9 for two hours idle and 3-9 for three - etc.

Paula
If you can spell SysAdmin then you is one - anon
Mark Greene_1
Honored Contributor

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

To extract a range of lines from a log file or other text file when you cannot grep a common pattern, try this script:

#!/bin/ksh
# process is sed -n 'StartLineNumber,EndingLineNumber' source_file > target_file
# $1=source file, $2=starting line, $3=ending line, $4=target file

if [ $# -lt 4 ]; then
echo "usage: extract source starting_line ending_line target"
exit
fi

SOURCE=$1
START_PAGE=$2
END_PAGE=$3p
TARGET=$4
QUOTE="'"

CMD="-n $QUOTE$START_PAGE,$END_PAGE$QUOTE"

eval "sed $CMD $SOURCE >$TARGET"

exit $?
the future will be a lot like now, only later
Deshpande Prashant
Honored Contributor

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

HI
Use setboot command to display/set the primary/alternate boot paths.

#setboot -p => sets pri boot path
#setboot -a => sets alt boot path

In mirrored root VG (vg00), I use this command to change boot path to test mirrors on next reboot.

Thanks.
Prashant Deshpande
Take it as it comes.
Darrell Allen
Honored Contributor

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

How to extract files from a tar archive made with absolute paths:

For example, tar made with:
tar cvf /tmp/users.tar /home/users

Extract for an alternate location with pax:
pax -r -s,/home/users,/home/users2, -f /tmp/users.tar

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Bill Hassell
Honored Contributor

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

Just a note about ps -ef and grep.

ps has a lot of options that are overlooked and grep is a very unstable way to look for processes or owners. grep does processes owned by root or it will find processes like chroot. Since the results always depend on what is actually running at that moment, the results are not dependable. For instance, looking for all sh programs will fail because grep finds sh, ksh, csh, bash, etc as well as users that are not running any sh processes but theirt user name happens to contain sh (like bashful or squish).

To find all processes owned by one user:

ps -u user_name

To find a specific process by name:

UNIX95= ps -C process_name


Bill Hassell, sysadmin
Kevin_31
Regular Advisor

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

# UNIX95=ps -C omni
sh: -C: not found.

?
James R. Ferguson
Acclaimed Contributor

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

Hi Kevin:

# UNIX95= ps -C omni

...not...

# UNIX95=ps -C omni

Note the blank character after the equal sign and before the 'ps' command. No semicolon either! This sets the UNIX95 variable for the duration of the command line *only*.

Regards!

...JRF...

Kelli Ward
Trusted Contributor

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

My favorite little tip to search for a text string within all files and subdirectories from your current directory:

find . -type f -exec grep -l '' {} \;

Nice post!

Kel
The more I learn, the more I realize how much more I have to learn. Isn't it GREAT!
T. M. Louah
Esteemed Contributor

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

1) Only in Database environment like Oracle:
To sort all the proceses by memory size:

# UNIX95= ps -eo vsz,ruser,args | sort -rn | more

If any of the processes are pushing more than 50 megs, run SAM & change maxdsiz to 512 MB or more. This requires a reboot If you have less than 2Gb of RAM, Oracle will have big problems with performance.

G'd luck
t++
Little learning is dangerous!
S.K. Chan
Honored Contributor

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

Filesystem copy to/from another machine. Make sure .rhosts is setup appropriately

PUSH method
-----------
# (find -xdev|cpio -coax) | remsh "cd ;cpio -icdmuxla"

PULL method
-----------
# remsh "cd ;find -xdev | cpio -coax"|cpio -icdmuxla
Hooi Siew Hoong_1
Frequent Advisor

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

to compare the difference between 2 text file
#diff


K.Vijayaragavan.
Respected Contributor

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

command to see the Hard disk parameters , make , partnumber and model number in HPUX is?

========================================>

#diskinfo /dev/rdsk/c#t#d#

-Vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

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

One simple command to get the physical RAM availability in the HP9000 system is?
====>

#grep -i physical /var/adm/syslog/syslog.log

-vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

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

Netscape Navigator for HPUX:
============================

Netscape Navigator for HPUX11.00 is availabe in the application CD 5/5 whose product number is B8342AA.

-Vijay
"Let us fine tune our knowledge together"
Hooi Siew Hoong_1
Frequent Advisor

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

To get a text file of man pages without the special characters(eg bold, highlight)

man |col -b >> file

BKUMAR
Frequent Advisor

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

Hi

for checking shared memory process

#ipcs
#ipcs -m

this helps for huge oracle process shared by memory
Unix Administration Most Dedicated and Challenging Career in the World
BKUMAR
Frequent Advisor

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

Hi

HA-MC/Service Guard-Cluster query commands

#cmquerycl
#cmcheckconf
#cmviewcl
#

Cluster run/halt commands

#cmruncl
#cmhaltcl
#cmrunnode
#cmhaltnode
#cmrunpkg
#cmhaltpkg
#cmhaltserv
#cmrunserv

Cluster package command

#cmmakepkg
#cmmodpkg
Unix Administration Most Dedicated and Challenging Career in the World
BKUMAR
Frequent Advisor

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

Hi

For handling the processors -HP

#icod

notifies the total processors utilized and avl on server which is on hold by HP
Unix Administration Most Dedicated and Challenging Career in the World
erics_1
Honored Contributor

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

To clear a hung console:

1. Power off the console
2. Hold down the 'D' key for 10 seconds while powering on the console.
3. Press the 'Enter' key

OR

Telnet to the system and kill the current console PID.
1. ps -ef|grep console
2. kill

Regards,
Eric
Richard Darling
Trusted Contributor

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

1) du -sk to get the total disk usage in 1024 blocks for a directory

2) put
stty erase ^?
in a script and called it b.

comes in handy when the damn terminal backspace key doesn't work...just enter b, and i'm all set.

3)wc -l in a pipe to get counts.

Richard Darling
Kurt Beyers.
Honored Contributor

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

Recreate the lvmtab file if you're having troubles with the definition of volumegroups:

#rm /etc/lvmtab

# vgscan

it might be a good idea to remove old vg directories in the /dev before doing the vgscan.

Kurt