Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 21

To recall the commands that you have issued in HP-UX, change the shell to korn

shell.

#ksh -o vi

Press ESC and K on the keyboard.

HP-UX 11i V2
# ioscan -fnC fc
Identify FC HBA Device Files

# fcmsutil /dev/td0 [vpd | stat]


Tachyon FC HBA Utility:
Topology, Speed (1/2GB), HW Path
Switch Domain/ID & port
Driver Version, Model, Link Statistics

# fcmsutil /dev/td0 get remote all


Display topology

# tddiag
Diagnostic gathering utility

# tdlist
List FC Devices, HW Path, and nport ID

11.31 uses the /etc/dfs/dfstab file instead of the /etc/exports file

Expired account
#/usr/lbin/modprpw -m exptm=0,lftm=0,expwarn=0,mintm=0

Reset root password, asking old password


1. vi /tcb/files/auth/r/root
2. edit :u_pwd=X.3WGimsdtwjo2mvi3nvDGQY:\
3. :u_pwd=:\
4. wq! (save)
5. passwd root
6. DONE

used to list processes using a file


fuser -cu [FileSystem]
fuser -ku [FileSystem] -> kill process using the fs

Extend HPUX FS
# lvextend -L 30000MB /dev/vgbea/lvbea
# extendfs -F vxfs /dev/vgbea/lvbea

**********************************
Umask Created Files Created Directories
-------------------------------------------------------------
000 666 (rw-rw-rw-) 777 (rwxrwxrwx)
002 664 (rw-rw-r--) 775 (rwxrwxr-x)
022 644 (rw-r--r--) 755 (rwxr-xr-x)
027 640 (rw-r-----) 750 (rwxr-x---)
077 600 (rw-------) 700 (rwx------)
277 400 (r--------) 500 (r-x------)
**********************************
**********************************
if crontab -e gives some random number, and you didn't see any existing cron, might
be you didn't set your EDITOR variable:

$ EDITOR=/usr/bin/vi
$ export EDITOR
$ crontab -e
***********************************

PATH=$PATH:/data/myscripts
export PATH

# Set up the search paths:


PATH=$PATH:.:/usr/local/bin

1. Edit /etc/PATH
# vi /etc/PATH

2. Add path
3. SAVE

***********************************
Problem with "swreg" or "swacl" on hpux 11.23
This is an unfortunate message in that the real reason is that either hostname or
IP address has changed recently. Restart swagentd:

/sbin/init.d/swagentd stop
/sbin/init.d/swagentd start

The swagentd program keeps networking information in its local memory after
starting.

TO ADD EXECUTE PERMISSION TO A FILE


chmod o+x [file]

u - user r - read
g - group w - write
o - other x - execute

TO REVOKE PERMISSIONF
chmod ugo-rwx [folder/file]

r w x
4 2 1

COMMAND TO GET A LISTING OF YOUR GROUP MEMBERSHIP


groups

BASIC LINUX PRINT COMMANDS


lpr - send to printer ex: lpr [filename]
lpq - display print queue ex: lpq -P [printer name]
lprm - remove from print queue ex: lprm -P [printer name]

COMMAND TO SEND A FILE TO ANOTHER PRINTER (NOT YOUR DEFAULT)


lpr -P [name of printer] [filename]

-p stands for "printer"


COMMAND TO LIST ALL/NEW INSTALLED PCI CARD
lspci

COMMAND TO COPY A DIRECTORY


cp -r

COMMAND TO GET A DETAILED LIST OF ALL PROCESSES


ps -aux

example output:
USER PID START TIME COMMAND
root 1 15:30 0:04 init
root 2 15:30 0.00 [keventd]
keeper 741 16:28 0:01 pine

USER - the process owner


PID - the process ID
START - the date or time when this process started
TIME - the amount of CPU time used by this process
COMMAND - the command that started the process

COMMAND TO LIST WORLD WIDE NAME (STORAGE)


First run ioscan -funC fc

ex:
fc 1 1/2/0/0 td CLAIMED INTERFACE HP Tachyon TL/TS Fibre Chan
nel Mass Storage Adapter
/dev/td1

ex:
fcmsutil [dev]

ex:
mdserv root:/> fcmsutil /dev/td1

Vendor ID is = 0x00103c
Device ID is = 0x001028
TL Chip Revision No is = 2.3
PCI Sub-system Vendor ID is = 0x00103c
PCI Sub-system ID is = 0x000006
Topology = PTTOPT_FABRIC
Local N_Port_id is = 0x010500
N_Port Node World Wide Name = 0x50060b00000835c7
N_Port Port World Wide Name = 0x50060b00000835c6
Driver state = ONLINE
Hardware Path is = 1/2/0/0
Number of Assisted IOs = 141842822
Number of Active Login Sessions = 2
Dino Present on Card = NO
Maximum Frame Size = 960
Driver Version = @(#) PATCH_11.00: libtd.a : Jul 15 200
2, 11:34:12, PHSS_26798
STEPS/COMMANDS TO EXTEND VG:
First - bdf the FS to be extended to see which volume it is mounted:
ex: bdf /md_tmp
Filesystem kbytes used avail %used Mounted on
/dev/vg03/lvmd_tmp 8880128 4159 8321266 0% /md_tmp
mounted on /dev/vg03/lvmd_tmp

run vgdisplay -v vg03


then look for the available PE
lvextend -l (available PE or size in Gb or Mb) /dev/vg03/lvname
Then unmount the FS
EX:
umount /dev/vg03/lvname

Then extend lvname


EX:
extendfs /dev/vg03/lvname

UNAME EXPLAINED:
uname -a

HP-UX tavi B.11.31 A 9000/800 1920004321 two-user license

In the example above, the system returned the following information:

HP-UX - Operating system name


tavi - System name
B.11.31 - Operating system release identifier
A - Operating system version identifier
9000/800 - Machine and model numbers
1290005321 - Machine identification number
two-user license - Operating system license level

CRON JOBS
pag sa usr/spool/cron/crontabs/ may root na file, yan yung file kung saan lahat
nakadefine yung cronjobs....
ngayon yung /usr/spool/mail may root filename din yan naman yung lahat ng log kung
ano ang tumakbo na tinawag
ng system(cronjobs,startup files..)

crontab -e - Edits the current crontab, or creates a new one.


crontab -l - Lists the contents of the crontab file.
crontab -r - Removes the crontab file.
crontab -u - Edits user's crontab.

CRON EXPLAINED:
0 12 * * * tar cv /work /home >/tarlog 2>&1

this example takes a tar backup of /work and /home every day at noon.

Here�s how this works (the letters under the first five fields of the example are
keyed to the explanations that follow):

0 12 * * * tar cv /work /home 1>/tarlog 2>&1A B C D E


A = minute
B = hour
C = day of the month
D = month of the year
E = day of the week (0 = Sunday)

An asterisk (*) means all legal values, so the asterisks in fields C, D, and
E mean do it every day of the year.
Note that standard output and standard error are redirected to /tarlog.

COMMAND TO STOP/START NFS SERVICE IN HP UX


/sbin/init.d/nfs.server stop
/sbin/init.d/nfs.server start

Check your /etc/rc.config.d/nfsconf on the client and see what START_MOUNTD is set
to.

If it is '0' then you need to make it '1'.

START_MOUNTD=1

"cd /sbin/init.d"
"./nfs.client stop"
"./nfs.server stop"
"./nfs.core stop"
"./Rpcd stop"

Then do these commands again, in reverse order, changing "stop" to "start"

COMMAND TO CREATE A LINK IN HP UX


ln -s [source FS] [target FS]
EX:
ln -s /u11/reports /home/sudo724/reports

FTP
ftp -i (hostname/ip address)
ftp> bin
ftp> get (filename)
*** NOTE :pag get ka usually kuha ka ng file tapos pag put naglalagay ka ng
file.....

COMMAND TO RESTART DAEMON (HP UX) FOR TELNET and FTP CONNECTIONS, FIRST
VI /ETC/INETD.CONF AND CHECK IF THE LINES FTP & TELNET HAS A #. IF IT HAS AN #
REMOVE IT, THEN RUN THIS COMMAND

inetd -c

TO DISABLE X FONT SERVER (XFS) UPON BOOTUP


vi /etc/X11/fs/config
Set the following variable: "RUN_X_FONT_SERVER=0"
COMMAND TO START IT:
EXECUTE: /sbin/init.d/xfs start

TO DISABLE SNMP
f you want to disable SNMP do the following:
# /sbin/init.d/SnmpMaster stop
Then edit /etc/rc.config.d/SnmpMaster as follows:
SNMP_MASTER_START=0

COMMAND TO START RPCBIND DAEMON


/sbin/init.d/nfs.core start

COMMAND TO START LOCKD AND STATD DAEMONS


/sbin/init.d/lockmgr start

COMMAND TO RUN THE NFS STARTUP SCRIPT


/sbin/init.d/nfs.server start

COMMAND TO RESTART EXPORT


/usr/sbin/exportfs -a

COMMAND TO DISABLE NFS SERVER CAPABILITY


/sbin/init.d/nfs.server stop
THEN ON THE NFS SERVER, EDIT /ETC/RC.CONFIG.D/NFSCONFIG FILE TO SET THE NFS_SERVER
VARIABLE TO 0. THIS PREVENTS THE NFS SERVER DAEMONS FROM STARTING WHEN THE SYSTEM
REBOOTS.

NFS_SERVER=0

COMMAND TO FORCIBLY START THE PCNFSD DAEMON WHILE SERVER IS RUNNING


/sbin/init.d/nfs.server start

COMMAND TO UNEXPORT DIRECTORY


/usr/sbin/exportfs -u {directory}
EX: /usr/sbin/exports -n roamcdr

COMMAND TO UNEXPORT ALL EXPORTED DIRECTORIES


/usr/sbin/exportfs -au

COMMAND TO LIST PORT NUMBERS


rpcinfo -p

TO DISABLE FTP:
You can disable ftp and telnet comment the line in /etc/inetd.conf file. simply put
# at the beggining of ftp.
When I upload file with ftp client to HP-UX, default right is used (u=rw, g=r,
o=nothing)How can I change rights for specified user?
ANS:
You can change the umask for ftp system wide only in

# vi /etc/inetd.conf
change default value

ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l

ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l -u002

the -u (umask)
002 rw-rw-r--

Disabling sendmail on HP-UX

In HP-UX, services are either enabled or disabled based on scripts that are located
in the /etc/rc.config.d directory. These scripts set environment variables that
tell the O/S which services should be started during system startup.

For sendmail, the script that is of concern in HP-UX is:


d
/etc/rc.config.d/mailservs

To disable the sendmail service, you need to edit this file and change the line
that says

export SENDMAIL_SERVER=1

to

export SENDMAIL_SERVER=0

Save the file, then restart your system and the sendmail service should be gone.

After making this change to the mailservs file, restart your system, then enter:

Ps -eaf | grep sendmail

to search for sendmail processes and to verify that the sendmail process does not
exist.

COMMAND TO STOP SENDMAIL


/sbin/init.d/sendmail stop

COMMAND TO RUN SECURE COPY


scp -r [LOGIN ID]@[IP ADDRESS OF THE SERVER]:[SOURCE FOLDER] [DESTINATION FOLDER]
EX:
scp -r Smb10469@10.226.132.232:/home/Smb10469/FSMON /home/cmdctr/

-p
->Preserves modification times, access times, and modes from the
original file.

COMMAND TO MOUNT CDROM


mount /mnt/cdrom

COMMAND TO UNMOUNT CDROM


umount /mnt/cdrom

COMMAND TO SET BACKSPACE IN HP UX


stty erase ^? (backspace key)

COMMAND TO SEE THE LARGEST FOLDER


du -x /[FOLDER NAME] |sort -n

TO SEE IP ADDRESS
netstat -in

TO GRANT READ/WRITE RIGHT TO AN FS WHICH IS OWNED BY ROOT:


vi /etc/group, add the id in the line where root is located;
ex : root::0:root,[login id]
Then ll |grep [fs]
ex:
#ll |grep roamcdr
#drwxr-xr-x 3 root root 96 Apr 9 2008 roamcdr
#chmod 775 roamcdr
#ll |grep roamcdr
#drwxrwxr-x 3 root root 96 Apr 9 2008 roamcdr

COMMAND IN HP UX TO BACKUP TO TAPE TWO FOLDERS (FS)


nohup /usr/sbin/fbackup -0 -u -v -f /dev/rmt/0mn -g /home/sajp2170/mddrpdb.g &
mddrpdb.g - holds the two fs for backup

COMMAND FOR HOUSEKEEPING


ls -l|grep -v .gz|grep -v "May 20"|grep -v "May 19"|grep -v "May 18"|grep -v "May
17"|grep -v "May 16"|sort -5n

find . -mtime +1 -exec rm -rf {} \;

COMMAND TO LIST ALL FILES ON A CERTAIN DATE THEN ZIP IT


gzip -9 `ls -ltr *.txt |grep "Oct 14" |awk '{print $NF}'|tr -s '\n' ' '`

***this example will list all files with date Oct 14

ls -ltr |egrep "Apr 4"|"Apr 5"| awk '{print $NF}' | xargs gzip

ls -ltr |egrep "Apr 4|Apr 5

TO ZERO OUT OR EMPTY A CERTAIN FILE


echo "[filename]" > [filename] - make sure that you use the same file name
ex: echo "mail.log" > mail.log

COMMAND TO LOOK FOR FILES GREATER THAN 10000


find . -size +10000 -print -xdev |more

COMMAND TO DELETE FILES OLDER THAN 1 DAY:


/usr/bin/find /{directory} -mtime +1 -exec rm {} \;
find . -mtime +1 -exec gzip -9 {} \;
+1 number of days, so +1 = more than 1 day

COMMAND TO DELETE ALL FILE IN THE TEST.TXT FILE


rm -rf `cat test.txt | awk '{print $9}'|tr -s '\n' ' '`

SAMPLE SCRIPT TO KILL A PROCESS


ps -ef |grep snmpd |grep -v grep|awk '{print $2}' |xargs kill -9

To Unzip:

gunzip `ll -tr *.gz|grep -i <month>|grep <year>|grep PAYMENTS|awk '{print


$NF}'|tr -s '\n' ' '`
To Zip:

gzip -9 `ll -tr *.txn|grep -i <month>|grep <year>|grep PAYMENTS|awk '{print


$NF}'|tr -s '\n' ' '`

***********************************************************************************
*************
Where:
<month> is the month to zip/unzip
(Jan/feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec)
<year> is the year to zip/unzip (2008, unless ontherwise
specified)

***********************************************************************************
*************

LOCATION OF ERROR LOGS IN HP UX:

/var/opt/resmon/log - event.log
/etc - shutdownlog
/var/adm/syslog - syslog.log

TO CHECK IF USER ACCOUNT IS LOCKED:


/usr/lbin/getprpw [userid]

uid=131, bootpw=NO, audid=42, audflg=1, mintm=-1, maxpwln=-1, exptm=-1, lftm=-1,


spwchg=-1, upwchg=-1, acctexp=-1, llog=-1, expwarn=-1, usrpick=DFT, syspnpw=DFT,
rstrpw=DFT, nullpw=DFT, admnum=-1, syschpw=DFT, sysltpw=DFT, timeod=-1, slogint=Thu
May 22 01:21:51 2008, ulogint=Thu May 22 07:44:48 2008, sloginy=-1, culogin=16,
uloginy=-1, umaxlntr=-1, alock=NO, lockout=0001000
TO UNLOCK/NULL THE PASSWORD OF A USER
/usr/lbin/modprpw -k [userid]

=====================================
USER=myusername
/usr/lbin/modprpw -l -m alock=NO $USER #removes lock
/usr/lbin/modprpw -k $USER #resets failed login
count
=====================================

COMMAND TO PUT AN ADMIN LOCK


/usr/lbin/modprpw -l or passwd -l

TO MANUALLY ADD USER (HP UX):


check first in /etc/passwd if the name already exists, then in
type /usr/sbin/useradd -c 'Comment' -m [userid]
ex: useradd -c 'Ajperalta-SysAd' -d /home/sajp2170 sajp2170

TO INSTALL SOFTWARE:
swinstall -s [absolute path]

TO SHOW PASSWORD OF A USER


/usr/lbin/modprpw -x [userid]

TO VIEW USER ID PROFILE


cat /etc/passwd | grep [userid]

COMMAND TO MANUALLY CHANGE USER ID PROFILE


vipw

COMMAND TO CHECK INTEGRITY OF PASSWD


pwck

SET OF COMMANDS TO RUN TO ISOLATE USER PROFILE


in /home mkdir [userid]
cp -rp /etc/skel /home/[userid]

USEFUL CSP COMMANDS:


FILE THAT HANDLES IP FILTERING:
IPRULES.CONF

COMMAND TO CHECK IF PORT IS BLOCKED OR NOT:


ipfstat -io

would display : empty list for ipfilter [in/out]

COMMAND TO BLOCK PORT:


/sbin/ipf -f /home/csp_oper/iprules.conf

COMMAND TO UNBLOCK PORT:


ipf -Fa

COMMAND TO SCP FILE FROM ONE SERVER TO ANOTHER:


1. From destination server
scp [userid]@[ip or hostname of server]:/[absolute path of source - filename]
[absolute path of destination - filename]

2. From source server


scp [absolute path of source - filename] [userid]@[ip or hostname of server]:
[absolute path of destination - filename]

ex:
root@csprp2pr[/veritas]# ls
SIM2_PRD_FULL.dmp.gz bckupidx lost+found
root@csprp2pr[/veritas]# scp -rp SIM2_PRD_FULL.dmp.gz
Smb10469@10.226.135.92:/sbl_tmp/cmss2_1/

TO CHECK FOR ATTACHED DEVICES:


ioscan -funC [device]

ex: ioscan -funC tape

TO CHECK STATUS OF TAPE:


mt -f [tape] status
ex: mt -f /dev/rmt/1m status

COMMAND TO CHECK/LIST CONTENT OF TAPE


mt -f /dev/ntape/[name of device] rewind
vrestore -i /dev/ntape/[location of the tape device]
then do ls
exit

COMMAND TO REWIND THEN EJECT TAPE


mt -f /dev/ntape/[name of device] rewoff

TO MOUNT TAPE:
mt /dev/rmt/0m

TO MOUNT FILE SYSTEM:


mount -f <file system type><mount point directory>
ex: mount -f jfs /dev/vg00/lvol6

COMMAND FOR DUMP:


/var/sbin/dump -u0f [dev] [fs to backup]
ex: /var/sbin/dump -u0f /dev/rmt/0m /oradata02

COMMAND FOR FBACKUP:


/usr/sbin/fbackup -u0f [dev] -i [fs to backup]
ex: /usr/sbin/fbackup -u0f /dev/rmt/0m -i /oradata02

TO RUN BACKUP WITH NO HUP:


nohup fbackup /dev/rmt/0m /home - (to regular backup /home)

nohup can also be used in ignite


HOW TO RUN IGNITE:
1. First Check if you have IgniteUX installed.

# swlist -l product | grep -i ignite

It will show like this:


Ignite-UX B.4.1.61 HP-UX System Installation Services

2. Execute the command :


#nohup /opt/ignite/bin/make_tape_recovery -v -I -x inc_entire=vg00 -a /dev/rmt/1mn
&

other command:
make_tape_recovery -Av -a /dev/rmt/**mn

3.How to check for successfull completion of the backup:

# cd /var/opt/ignite/recovery/latest date
# cat recovery.log | grep -i successful

If it shows unsuccessful , then backup is not proper, go through log , else


everything looks fine.

4. How to restore system , in the event of a failure:

(i) Interrupt normal boot process:


(ii) At PDC : check for the tape device path.
(iii) boot TAPE_DEVICE_PATH
(iv) Ignite tape will recover the entire vg00.

COMMAND TO VI IN COMMAND PROMPT


ksh -o vi

COMMAND TO VIEW KERNEL PARAMETERS IN HP UX


kmtune

COMMAND TO VIEW IO/DISK UTIL IN HP UX


sar -d [5 5]

AIX-IBM

unlock account
# chsec -f /etc/security/lastlog -a unsuccessful_login_count=0 -s [user]
# chuser account_locked=false [user]
# lsuser [user]
-for checking

COMMAND TO RUN (AGAIN) CRON JOBS

nohup /usr/sbin/cron &


TO LOOK FOR ERROR MESSAGES:
/var/logs/messages
/var/adm/log - log file of cron

TO START CRON JOBS IN LINUX:


service crond start

TO STOP/START SSH:
/sbin/init.d/secsh stop/start

OS-SUN OS-SUN OS-SUN OS-SUN OS-SUN OS-SUN OS-SUN OS-SUN OS-SUN OS

LOCATION OF VISUDO
/usr/local/sbin/visudo

SMC - command to run to initiate GUI

CHECK DEVICES
/usr/sbin/prtdiag

COMMAND TO LIST DISK SPACE


df -F ufs -o i

COMMAND TO CHECK SERVER STAT (TOP):


vmstat 1 10

SHOW IP ADDRESS
#ifconfig -a

TO UNLOCK PASSWORD
passwd -u [userid]

SUDO LOCATION:
/usr/local/bin
./sudo su -

password less root plus script


trap "" 2 3
/usr/local/bin/sudo su - root -c "/export/home/cmdctr/comcen.sh"

Adding new group


Use groupadd command to add group called pusers:

# groupadd pusers

Create a group called sshusers with GID 500:

# groupadd �g 500 sshusers

Add new user volini to group sshusers:


# useradd �d /nas/home/v/volini -m volini

Add existing user rose to group sshusers:

# usermod -G pusers rose

Rename group
Change the name sshusers to ftpusers:

# groupmod -n ftpusers sshusers

Delete the group


Remove the group called foxadmin

# groupdel foxadmin

If you manually modified the /etc/group file then you can check any group file
inconsistencies with grpck command:

# vi /etc/group
# grpck

Weird useradd problem:


Suggestions were:
1. permissions on passwd and shadow files
2. full / file system
3. corrupt useradd file
4. missing files
5. truss -o /tmp/useradd.truss -f useradd xxxxxxxx (Good stuff!)

CREATE USER:
useradd -m -d /export/home/<userame> -s /bin/bash <username>

OSF1-OSF1-OSF1-OSF1-OSF1-OSF1-OSF1-OSF1-OSF1-OSF1-OSF1-OSF1-OSF1-OSF1
TO CHECK SERVICES/DAEMON IN OSF1:

Check the file inetd.conf located in


/etc and look if the service is not commented out (with #)
Then run kill -HUP [process id of inetd.conf] (kill -l to list signals)
ex: kill -HUP 972
the 972 is the process id of inetd which holds all the services like telnet, shell,
ftp, login, exec, etc.

TO GO TO SUDO IN OSF1:
/usr/local/bin

COMMAND TO RUN IF THERE IS NO SUDO


/usr/sbin/dop -n su -

TO UNLOCK USER ACCOUNT IN OSF1:


usermod -x administrative_lock_applied=0 [username]

TO ADD USER IN OSF1:


useradd [userid]
usermod -x administrative_lock_applied=0 [userid]
usermod -x grace_limit=60000 [userid]
mkdir /usr/users/[userid]
chown [userid] /usr/users/[userid]

enables root account on Tru64 UNIX)

/usr/sbin/usermod -x administrative_lock_applied=0 [userid]

/usr/sbin/usermod -x passwd_expire_time=0 [userid]

/usr/sbin/usermod -x passwd_lifetime=0 [userid]

/usr/sbin/usermod -x passwd_min_change_time=0 [userid]

FILE THAT HANDLES IP FILTERING:


/etc/ifaccess.conf

LOCATION OF /HOME IN OSF - /usr/users

LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX

COMMAND TO HIDE IP FROM BEING PINGED


/sbin/iptables -A INPUT -p icmp -j DROP

COMMAND TO UNHIDE IP FROM BEING PINGED


/sbin/iptables -F

COMMAND TO INCLUDE START UP OF SQUID DURING STARTUP


chkconfig squid on

TO CHECK THE PORT USED IN SQUID


view /etc/squid/squid.conf will display "http_port [port]"

COMMAND TO CHECK FOR MODULES (TAPES, DRIVES)


lsmod

COMMAND TO INVOKE MODULE FOR DEVICE SCSI TAPE


insmod st

COMMAND TO POKE ALL NEW DEVICES


/etc/rc.d/init.d/kudzu start

COMMAND TO CHECK THE VERSION OF LINUX


cat /etc/redhat-release

COMMAND TO LIST ALL PCI DEVICES


lspci
FILE TO EDIT IN LINUX NOT TO BOOT IN GUI MODE
in file /etc/inittab locate id: and change the value to 3
ex:
id:3:initdefault:

TO LIST SWAP DISK IN LINUX


free

IF YOU CANNOT PING THE IP ADDRESS OF THE SERVER, RUN THIS COMMAND
/sbin/iptables -F

TO START CRON JOBS IN LINUX:


service crond start

ACTIVATING/DEACTIVATING NIC

TO ACTIVATE - /sbin/ifup eth0 or ifconfig eth0 up


TO DE-ACTIVATE - /sbin ifdown eth0 or ifconfig eth0 down
*NOTE* these scripts use the scripts and NIC config files in
/etc/sysconfig/network-scripts/

CHANGING THE HOST NAME

1. Issue the command: hostname [new-host-name]


2. Change network config file: /etc/sysconfig/network
edit entry: HOSTNAME={new-host-name]
3. Restart systems w/c relied on the hostname (or reboot0:
Restart network services: service network restart
or /etc/init.d/network restart
Restart desktop:
Bring down system to console mode: init 3
Bring up X-Windows: init 5

TO TURN ON IP FORWARDING
echo 1 > /proc/sys/net/ipv4/ip_forward
Default is 0. One can add firewall by using ipchains
Another method is to alter the Linux kernel config file

COMMAND TO LOOK AT THE KERNEL MESSAGES


dmesg

COMMAND TO UP/DOWN A NIC


ifup [nic]
ifdown [nic]

COMMAND TO EDIT STATIC IP


/etc/sysconfig/network-scripts
edit the file ifcfg-eth0 or ifcfg-eth1 depending on what lan/nic card is active in
your server

COMMAND TO CREATE A CRON


crontab -e - cron file created is located in /var/spool/cron
ex: 0,15,30,45 * * * * top n 1 b >> /home/smb10469/top.log

COMMAND TO COMPARE CONTENTS OF TWO FILES


redirect the output file to txt file, ex:
/usr/sbin/vgdisplay -v vgdata09_cx380 | grep -E 'LV Name | LV Size' > cx380.txt
/usr/sbin/vgdisplay -v vgdata09_new | grep -E 'LV Name | LV Size' > new09.txt

Then vi any of the file,and add this:


1,$s/[unique name]/[name]/g

Then execute this command


diff [file.txt] [file1.txt] - note: file.txt & file1.txt are the name of files that
are to be compared.

COMMAND TO LIST FILES DONE IN THE MONTH OF MAY, CASE SENSITIVE, 9TH FIELD,
TRANSLATE ALL OCCURENCES OF NEW LINE TO SPACE
ls -ltr | grep -i may | awk '{print $9}' | tr -s '\n' ' '

ls -ltr [filename]|awk '{print $NF}' |tr -s '\n' ' '


WHERE:
$NF - name of file
\n - enter (find)
' ' - space (replace)

cat [filename]|tr -s '\n' ' ' > [filename]


diff or cmp [filename] [filename];echo $?
WHERE:
;echo $? - give the result (exit status either 0 or non zero)

COMMAND TO DELETE FILES USING THE MONTH OF MAY IN GREP, FIRST 1000
rm -rf `ls -ltr | grep -i may | head -1000 |awk '{print $NF}' | tr -s '\n' ' '`
` ` - BACKTICK USED FOR COMMAND SUBSTITUTION. WILL DO THE COMMAND INSIDE OF
BACKTICK

COMMAND TO DISPLAY THE COUNT OF FILES DONE IN THE MONTH OF MAY


ls -ltr | grep -i may | wc -l

COMMAND TO SORT BIGGEST FOLDER AND DISPLAY LAST BIG 40


du -axk /appl |sort -n |tail -40

LOCATION OF CPU AND MEMORY INFO:


/proc folder then for CPU type "cat cpuinfo" while for memory type "cat meminfo"

OTHERS
#lsmod ====>>check for the module st(scsi tape)
#cat /proc/scsi/scsi
#cat /proc/stat
#cat /proc/devices
#cat /proc/scsi
#cat /proc/pci
#lspci
#cat /var/log/messages
#cat /var/log/dmesg
#insmod st =====>>>>will invoke module for st (scsi tape)
#mt -f /dev/st0 status
#cdrecord =scanbus ===>>>will show all devices (disk/tape)
#cat /etc/modules.conf
#cat /etc/sysconfig/hwconfig archive
#/etc/rc.d/init.d/kudzu start======>>>this will poke all the new deives

IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM

COMMAND TO LIST TAPE


lsdev -Cc tape

COMMAND TO LIST TAPE CONFIGURATION(SERIAL #, OTHER)


lscfg -vl [tape name]

FOR CHECKING:
ps -eaf |grep root |grep java |grep -v grep |awk '{print $2, $3}' |xargs kill -9

SOLARIS SOLARIS SOLARIS SOLARIS SOLARIS SOLARIS SOLARIS

LOCATION OF VISUDO

/usr/local/sbin/visudo

LOCATION OF SUDO
/usr/local/bin/sudo su -

#!/bin/sh - posix(sh) shell


#!/usr/bin/ksh - ksh, bourne shell

reset password HP-UX


/usr/lbin/modprpw -x [username]

Restart Apache(linux)
/etc/init.d/httpd restart

*lvextend
EXAMPLES
Increase the number of the logical extents of a logical volume to 100:

lvextend -l 100 /dev/vg01/lvol3

Increase the logical volume size to 400 MB:

lvextend -L 400 /dev/vg01/lvol4

Allocate two mirrors (that is, two copies of the original) for each logical extent
of a logical volume:

lvextend -m 2 /dev/vg01/lvol5
Mirror a logical volume onto a particular physical volume.

lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c0t3d0

Increase the size of a file system existing on a logical volume.

First, increase the size of the logical volume.


lvextend -L 400 /dev/vg06/lvol3

Unmount the file system.


umount /dev/vg06/lvol3

Extend the file system to occupy the entire (larger) logical volume.
extendfs /dev/vg06/rlvol3

Remount the file system.


mount /dev/vg06/lvol3 /mnt
****************

CCB servers housekeep


du -akx /home | sort -n | tail -50
*********************
*10.226.133.14 *
*administrator *
*zxcpoi1234$$ *
*********************

Start telnet
/sbin/init.d/inetd start

tru-64 (OSF1)
unlock password: usermod -x administrative_lock_applied=0 <username>

=============================
recover file from tape

#frecover -f [tape location] -i [file] -Xxv


Where X means relative path

=============================
hp-ux
NFS step by step
1. #cat etc/hosts
-check ip address of both servers.
-if not edit and insert ip and hostname.
2. #vi etc/exports
-insert full path of FS to shared.
-[shared path] -anon=65534
3. #/usr/sbin/exportfs -a
-sharing host
4. #mkdir [mount point]
-connecting host
5. #mount [ip of sharing host]:[shared full path of FS] [mount point]

=============================
check if large file is allowed
a. fsadm -F vxfs /dev/vg00/rlvfmsdev
or
b. cat /etc/fstab|grep [FS]

============================
ksh -o vi #will let you return to previous commands

============================
TRACKER
http://10.226.224.11/mapGlobe/mapABS.cfm?SUB_Mobtel=

=============================
for chtosapp tape drive problem
/opt/ltt/
./hp_ltt

/etc/rc.d
tapeDrive.sh

/home/srjc0677
rescan-scsi-bus.sh
=============================

How do I view contents of an fbackup tape?

Type the following command:


# frecover -f /dev/rmt/0m -x -N -v

=============================
BACKUP UNIX

a] dump / restore command (HFS filesystem only)

b] vxdump / vxrestore (vxfs filesystem only)

c] cpio command

d] fbackup / frecover command

e] dd command

f] tar command

g] make_net_recovery or make_tape_recovery commands


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

How to check if an rpm package is installed on a Red Hat Linux server


$ rpm -qa | grep samba
samba-common-3.0.9-1.3E.14.1
samba-3.0.9-1.3E.14.1
samba-client-3.0.9-1.3E.14.1

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

logout users hp-ux

kill -9 $(ps -fu <userid> | awk 'BEGIN {getline} {print $2}')

You might also like