Unix Commands
Unix Commands
shell.
#ksh -o vi
HP-UX 11i V2
# ioscan -fnC fc
Identify FC HBA Device Files
# tddiag
Diagnostic gathering utility
# tdlist
List FC Devices, HW Path, and nport ID
Expired account
#/usr/lbin/modprpw -m exptm=0,lftm=0,expwarn=0,mintm=0
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
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.
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
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
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
UNAME EXPLAINED:
uname -a
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..)
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):
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.
Check your /etc/rc.config.d/nfsconf on the client and see what START_MOUNTD is set
to.
START_MOUNTD=1
"cd /sbin/init.d"
"./nfs.client stop"
"./nfs.server stop"
"./nfs.core stop"
"./Rpcd stop"
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 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
NFS_SERVER=0
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
the -u (umask)
002 rw-rw-r--
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.
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:
to search for sendmail processes and to verify that the sendmail process does not
exist.
-p
->Preserves modification times, access times, and modes from the
original file.
TO SEE IP ADDRESS
netstat -in
ls -ltr |egrep "Apr 4"|"Apr 5"| awk '{print $NF}' | xargs gzip
To Unzip:
***********************************************************************************
*************
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)
***********************************************************************************
*************
/var/opt/resmon/log - event.log
/etc - shutdownlog
/var/adm/syslog - syslog.log
=====================================
USER=myusername
/usr/lbin/modprpw -l -m alock=NO $USER #removes lock
/usr/lbin/modprpw -k $USER #resets failed login
count
=====================================
TO INSTALL SOFTWARE:
swinstall -s [absolute path]
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 MOUNT TAPE:
mt /dev/rmt/0m
other command:
make_tape_recovery -Av -a /dev/rmt/**mn
# cd /var/opt/ignite/recovery/latest date
# cat recovery.log | grep -i successful
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
TO STOP/START SSH:
/sbin/init.d/secsh stop/start
LOCATION OF VISUDO
/usr/local/sbin/visudo
CHECK DEVICES
/usr/sbin/prtdiag
SHOW IP ADDRESS
#ifconfig -a
TO UNLOCK PASSWORD
passwd -u [userid]
SUDO LOCATION:
/usr/local/bin
./sudo su -
# groupadd pusers
Rename group
Change the name sshusers to ftpusers:
# 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
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:
TO GO TO SUDO IN OSF1:
/usr/local/bin
LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX-LINUX
IF YOU CANNOT PING THE IP ADDRESS OF THE SERVER, RUN THIS COMMAND
/sbin/iptables -F
ACTIVATING/DEACTIVATING NIC
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 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' ' '
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
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
FOR CHECKING:
ps -eaf |grep root |grep java |grep -v grep |awk '{print $2, $3}' |xargs kill -9
LOCATION OF VISUDO
/usr/local/sbin/visudo
LOCATION OF SUDO
/usr/local/bin/sudo su -
Restart Apache(linux)
/etc/init.d/httpd restart
*lvextend
EXAMPLES
Increase the number of the logical extents of a logical volume to 100:
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.
Extend the file system to occupy the entire (larger) logical volume.
extendfs /dev/vg06/rlvol3
Start telnet
/sbin/init.d/inetd start
tru-64 (OSF1)
unlock password: usermod -x administrative_lock_applied=0 <username>
=============================
recover file from tape
=============================
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
=============================
=============================
BACKUP UNIX
c] cpio command
e] dd command
f] tar command
=============================