Unix_Basic_v0.1
description
Transcript of Unix_Basic_v0.1
-
Appendix
1
UNIX COMMAND ifconfig
UNIX COMMAND cd
UNIX COMMAND pwd
UNIX COMMAND ls
UNIX COMMAND mkdir
UNIX COMMAND rmdir
UNIX COMMAND cp
UNIX COMMAND mv
UNIX COMMAND rm
UNIX COMMAND grep
UNIX COMMAND kill
UNIX COMMAND head
UNIX COMMAND tail
UNIX COMMAND more
UNIX COMMAND tar
UNIX COMMAND zip
UNIX COMMAND unzip
UNIX COMMAND cat
UNIX COMMAND du
UNIX COMMAND find
UNIX COMMAND su
UNIX COMMAND split and cat
UNIX COMMAND crontab
DBMS startup/stop
Veritas Cluster Server Management
UNIX COMMAND pkgadd/rm/info
UNIX COMMAND lsof
UNIX COMMAND uname
UNIX COMMAND RUP
UNIX COMMAND IOSTAT
UNIX COMMAND VMSTAT
UNIX COMMAND TOP
-
2
Appendix UNIX COMMAND - ifconfig
USAGE
The ifconfig command changes/verify IP
Address of your current working system.
Sun Microsystems Inc. SunOS 5.9 Generic May 2002 # bash [root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/] ifconfig -a lo0: flags=1000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 ce0: flags=1000843 mtu 1500 index 2 inet 192.168.2.64 netmask ffffff00 broadcast 192.168.2.255 ether 0:3:ba:a2:2e:c4 ce2: flags=1000843 mtu 1500 index 3 inet 172.18.98.56 netmask ffffffc0 broadcast 172.18.98.63 ether 0:3:ba:a2:2e:c6 [root@SHT_RBT_TB_SERVER:/]
[root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/] ifconfig ce2 ce2: flags=1000843 mtu 1500 index 3 inet 172.18.98.56 netmask ffffffc0 broadcast 172.18.98.63 ether 0:3:ba:a2:2e:c6 [root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/]
Type " /usr/sbin/ifconfig " at a telnet command prompt to
create|remove|check a new networ device.
-
3
Appendix UNIX COMMAND - ifconfig
USAGE
The ifconfig command changes/verify IP
Address of your current working system.
Sun Microsystems Inc. SunOS 5.9 Generic May 2002 # bash [root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/]ifconfig ce0 unplumb (NIC REMOVE) [root@SHT_RBT_TB_SERVER:/]ifconfig ce0 plumb (NIC CREATE) [root@SHT_RBT_TB_SERVER:/]ifconfig ce0 192.168.2.64 netmask 255.255.255.0 up [root@SHT_RBT_TB_SERVER:/]ifconfig -a lo0: flags=1000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 ce2: flags=1000843 mtu 1500 index 3 inet 172.18.98.56 netmask ffffffc0 broadcast 172.18.98.63 ether 0:3:ba:a2:2e:c6 ce0: flags=1000843 mtu 1500 index 4 inet 192.168.2.64 netmask ffffff00 broadcast 192.168.2.255 ether 0:3:ba:a2:2e:c4
[root@SHT_RBT_TB_SERVER:/]ifconfig ce0 ce0: flags=1000843 mtu 1500 index 4 inet 192.168.2.64 netmask ffffff00 broadcast 192.168.2.255 ether 0:3:ba:a2:2e:c4
Type " /usr/sbin/ifconfig " at a telnet command prompt to
create|remove|check a new networ device.
-
4
Appendix UNIX COMMAND - CD
USAGE
The cd command changes your current
working directory to the directory that you
specify
Sun Microsystems Inc. SunOS 5.9 Generic May 2002 # bash [root@SHT_RBT_TB_SERVER:/]cd [root@SHT_RBT_TB_SERVER:/]cd / [root@SHT_RBT_TB_SERVER:/]cd /etc [root@SHT_RBT_TB_SERVER:/etc]cd [root@SHT_RBT_TB_SERVER:/]cd /temp [root@SHT_RBT_TB_SERVER:/temp]cd [root@SHT_RBT_TB_SERVER:/]cd /temp [root@SHT_RBT_TB_SERVER:/temp]cd ~ [root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/etc/default]cd ../ [root@SHT_RBT_TB_SERVER:/etc]
[root@SHT_RBT_TB_SERVER:/]su - prbt Sun Microsystems Inc. SunOS 5.9 Generic May 2002 SHT_RBT_TB_SERVER:(prbt):/data/prbt> SHT_RBT_TB_SERVER:(prbt):/data/prbt> cd bin SHT_RBT_TB_SERVER:(prbt):/data/prbt/bin> cd ~ SHT_RBT_TB_SERVER:(prbt):/data/prbt> SHT_RBT_TB_SERVER:(prbt):/data/prbt> cd bin SHT_RBT_TB_SERVER:(prbt):/data/prbt/bin> cd ../ SHT_RBT_TB_SERVER:(prbt):/data/prbt>
-
5
Appendix UNIX COMMAND - PWD
USAGE
The pwd command tells you what the current
working directory you are in on your Virtual Server
Sun Microsystems Inc. SunOS 5.9 Generic May 2002 # bash [root@SHT_RBT_TB_SERVER:/]cd /etc/default [root@SHT_RBT_TB_SERVER:/etc/default]pwd /etc/default [root@SHT_RBT_TB_SERVER:/etc/default]
[root@SHT_RBT_TB_SERVER:/]su - prbt Sun Microsystems Inc. SunOS 5.9 Generic May 2002 SHT_RBT_TB_SERVER:(prbt):/data/prbt> cd bin SHT_RBT_TB_SERVER:(prbt):/data/prbt/bin> pwd /data/prbt/bin SHT_RBT_TB_SERVER:(prbt):/data/prbt/bin> cd SHT_RBT_TB_SERVER:(prbt):/data/prbt>
-
6
Appendix UNIX COMMAND - ls
USAGE
The ls command lists the files and subdirectories of the current directory you are in. You can also add some
arguments to the ls command to make it more meaningful
If you type "ls -F" it will append a forward slash to the subdirectory names so you can easily distinguish them from
file names.
If you type "ls -a" it will show all hidden files such as .htaccess files.
If you type "ls -l" it will show detailed information about each file and directory, including permissions, owners, size,
and when the file was last modified.
[root@SHT_RBT_TB_SERVER:/tmp] ls hsperfdata_prbt hsperfdata_root output.txt screens [root@SHT_RBT_TB_SERVER:/tmp] ls -l total 48 drwxr-xr-x 2 prbt other 117 Jul 18 14:41 hsperfdata_prbt drwxr-xr-x 2 root other 241 Jul 18 21:09 hsperfdata_root -rw-r--r-- 1 root other 0 Jul 10 11:53 output.txt drwxr-xr-x 3 root other 180 Sep 8 2008 screens [root@SHT_RBT_TB_SERVER:/tmp] ls -a . .X11-pipe hsperfdata_prbt output.txt .. .X11-unix hsperfdata_root screens [root@SHT_RBT_TB_SERVER:/] ls -F /tmp hsperfdata_prbt/ hsperfdata_root/ output.txt screens/ [root@SHT_RBT_TB_SERVER:/]
-
7
Appendix UNIX COMMAND - ls
USAGE
The ls command lists the files and
subdirectories of the current directory you are
in. You can also add some arguments to the ls
command to make it more meaningful
[root@SHT_RBT_TB_SERVER:/] ls -laR /tmp /tmp: /tmp/hsperfdata_root: total 160 drwxr-xr-x 2 root other 241 Jul 18 21:09 . drwxrwxrwt 8 root sys 524 Jul 19 03:30 .. -rw------- 1 root other 32768 Jul 18 17:28 26384 -rw------- 1 root other 32768 Jul 18 19:03 27245 /tmp/screens: total 48 drwxr-xr-x 3 root other 180 Sep 8 2008 . drwxrwxrwt 8 root sys 524 Jul 19 03:30 .. drwx------ 2 root other 1192 Jul 11 23:53 S-root /tmp/screens/S-root: total 32 drwx------ 2 root other 1192 Jul 11 23:53 . drwxr-xr-x 3 root other 180 Sep 8 2008 .. prw------- 1 root other 0 Mar 31 10:31 23839.DB1 prw------- 1 root other 0 Jul 12 03:21 23884.DB2 prw------- 1 root other 0 Mar 31 10:32 23897.FE1 [root@SHT_RBT_TB_SERVER:/]
-
8
Appendix UNIX COMMAND - mkdir
USAGE
The mkdir command makes a new directory.
Simply type "mkdir directory" at a telnet
command prompt and replace directory with
the name of the directory you want to create
[root@SHT_RBT_TB_SERVER:/tmp]mkdir test.d [root@SHT_RBT_TB_SERVER:/tmp]ls hsperfdata_prbt hsperfdata_root output.txt screens test.d [root@SHT_RBT_TB_SERVER:/tmp]ls -F hsperfdata_prbt/ hsperfdata_root/ output.txt screens/ test.d/ [root@SHT_RBT_TB_SERVER:/tmp]mkdir -p /tmp/test.d/test2.d [root@SHT_RBT_TB_SERVER:/tmp]ls -laR /tmp/test.d /tmp/test.d: total 48 drwxr-xr-x 3 root other 181 Jul 19 16:17 . drwxrwxrwt 9 root sys 587 Jul 19 16:15 .. drwxr-xr-x 2 root other 117 Jul 19 16:17 test2.d /tmp/test.d/test2.d: total 32 drwxr-xr-x 2 root other 117 Jul 19 16:17 . drwxr-xr-x 3 root other 181 Jul 19 16:17 .. [root@SHT_RBT_TB_SERVER:/tmp]
Type "mkdir test.d" at a telnet command prompt to create a
new directory called test.d.
-
9
Appendix UNIX COMMAND - mkdir
USAGE
The rmdir command deletes (removes) a
directory. Simply type "rmdir directory" at a
telnet command prompt and replace
directory with the name of the directory you
want to delete
[root@SHT_RBT_TB_SERVER:/tmp]rmdir ./test.d rmdir: directory "./test.d": Directory not empty [root@SHT_RBT_TB_SERVER:/tmp] [root@SHT_RBT_TB_SERVER:/tmp]cd test.d [root@SHT_RBT_TB_SERVER:/tmp/test.d]ls test2.d [root@SHT_RBT_TB_SERVER:/tmp/test.d]ls -F test2.d/ [root@SHT_RBT_TB_SERVER:/tmp/test.d]rmdir test2.d/ [root@SHT_RBT_TB_SERVER:/tmp/test.d]cd .. [root@SHT_RBT_TB_SERVER:/tmp]rmdir test.d/ [root@SHT_RBT_TB_SERVER:/tmp]
Type "rmdir test.d" at a telnet command prompt to remove a
directory called test.d
-
10
Appendix UNIX COMMAND - cp
USAGE
The cp command copies a file to a new location or filename.
Simply type "cp filename copyname" at a telnet command
prompt and replace filename with the name of the file you
want to copy, and copyname with the name of the new copy
[root@SHT_RBT_TB_SERVER:/tmp]touch readme.txt [root@SHT_RBT_TB_SERVER:/tmp]chmod 777 readme.txt [root@SHT_RBT_TB_SERVER:/tmp]cp readme.txt readyou.txt [root@SHT_RBT_TB_SERVER:/tmp]ls -l read* -rwxrwxrwx 1 root other 0 Jul 19 16:24 readme.txt -rwxr-xr-x 1 root other 0 Jul 19 16:24 readyou.txt [root@SHT_RBT_TB_SERVER:/tmp] [root@SHT_RBT_TB_SERVER:/tmp]rm readyou.txt [root@SHT_RBT_TB_SERVER:/tmp]cp -rfp readme.txt readyou.txt [root@SHT_RBT_TB_SERVER:/tmp]ls -l read* -rwxrwxrwx 1 root other 0 Jul 19 16:24 readme.txt -rwxrwxrwx 1 root other 0 Jul 19 16:24 readyou.txt [root@SHT_RBT_TB_SERVER:/tmp]
Type "cp readme.txt readyou.txt" at a telnet command
prompt to copy a file called readme to a file called
readyou.txt
TIP!!!
If you want to copy file with file original permission, you shall
use option p with other option.
-
11
Appendix UNIX COMMAND - mv
USAGE
The mv command renames a file or moves it to a new location. Simply
type "mv oldfile newfile" at a telnet command prompt and replace
oldfile with the name of the file you want to rename or move, and
newfile with the new name of the new file
[root@SHT_RBT_TB_SERVER:/tmp] mv readme.txt readyou.txt [root@SHT_RBT_TB_SERVER:/tmp] ls -l read* -rwxrwxrwx 1 root other 0 Jul 19 16:24 readyou.txt [root@SHT_RBT_TB_SERVER:/tmp] ls hsperfdata_prbt hsperfdata_root output.txt readyou.txt screens [root@SHT_RBT_TB_SERVER:/tmp] ls -l total 48 -rw-r--r-- 1 root other 0 Jul 10 11:53 output.txt -rwxrwxrwx 1 root other 0 Jul 19 16:24 readyou.txt drwxr-xr-x 3 root other 180 Sep 8 2008 screens [root@SHT_RBT_TB_SERVER:/tmp] [root@SHT_RBT_TB_SERVER:/tmp] mv readyou.txt readme.txt [root@SHT_RBT_TB_SERVER:/tmp] [root@SHT_RBT_TB_SERVER:/tmp] ls -l total 48 -rw-r--r-- 1 root other 0 Jul 10 11:53 output.txt -rwxrwxrwx 1 root other 0 Jul 19 16:24 readme.txt drwxr-xr-x 3 root other 180 Sep 8 2008 screens [root@SHT_RBT_TB_SERVER:/tmp]
Type "mv readme.txt readyou.txt" at a telnet command prompt
to move a file called readme.txt to a file called readyou.txt
-
12
Appendix UNIX COMMAND - rm
USAGE
Usage: The rm command deletes (removes) a file. Simply type
"rm filename" at a telnet command prompt and replace
filename with the name of the file you want to delete
[root@SHT_RBT_TB_SERVER:/tmp]ls -l total 48 drwxr-xr-x 2 prbt other 117 Jul 18 14:41 hsperfdata_prbt drwxr-xr-x 2 root other 241 Jul 18 21:09 hsperfdata_root -rw-r--r-- 1 root other 0 Jul 10 11:53 output.txt -rwxrwxrwx 1 root other 0 Jul 19 16:24 readme.txt drwxr-xr-x 3 root other 180 Sep 8 2008 screens [root@SHT_RBT_TB_SERVER:/tmp] [root@SHT_RBT_TB_SERVER:/tmp] rm readme.txt [root@SHT_RBT_TB_SERVER:/tmp] [root@SHT_RBT_TB_SERVER:/tmp] ls -l total 48 drwxr-xr-x 2 prbt other 117 Jul 18 14:41 hsperfdata_prbt drwxr-xr-x 2 root other 241 Jul 18 21:09 hsperfdata_root -rw-r--r-- 1 root other 0 Jul 10 11:53 output.txt drwxr-xr-x 3 root other 180 Sep 8 2008 screens [root@SHT_RBT_TB_SERVER:/tmp]
Type "rm readme.txt" at a telnet command prompt to
remove a file called readme.txt.
-
13
Appendix UNIX COMMAND - rm
USAGE
Usage: The rm command deletes (removes) a file. Simply type
"rm filename" at a telnet command prompt and replace
filename with the name of the file you want to delete
[root@SHT_RBT_TB_SERVER:/tmp] mkdir test.d [root@SHT_RBT_TB_SERVER:/tmp] touch ./test.d/readme.txt [root@SHT_RBT_TB_SERVER:/tmp] ls -l total 64 drwxr-xr-x 2 prbt other 117 Jul 18 14:41 hsperfdata_prbt drwxr-xr-x 2 root other 241 Jul 18 21:09 hsperfdata_root -rw-r--r-- 1 root other 0 Jul 10 11:53 output.txt drwxr-xr-x 3 root other 180 Sep 8 2008 screens drwxr-xr-x 2 root other 184 Jul 19 21:28 test.d [root@SHT_RBT_TB_SERVER:/tmp] rm test.d rm: test.d is a directory [root@SHT_RBT_TB_SERVER:/tmp] rm -r test.d [root@SHT_RBT_TB_SERVER:/tmp] ls -l total 48 drwxr-xr-x 2 prbt other 117 Jul 18 14:41 hsperfdata_prbt drwxr-xr-x 2 root other 241 Jul 18 21:09 hsperfdata_root -rw-r--r-- 1 root other 0 Jul 10 11:53 output.txt drwxr-xr-x 3 root other 180 Sep 8 2008 screens
Type "rm -r readme.txt" at a telnet command prompt to
remove a file called readme.txt.
-
14
Appendix UNIX COMMAND - grep
USAGE
The grep command finds lines in files that match specified text patterns. Simply type
"grep "text" filenames" at a telnet command prompt and replace "text" with the word
or phrase you want to search for, and replace filenames with the files you want to
search in. To search all files in the current directory, simply replace filenames with *.
[root@SHT_RBT_TB_SERVER:/tmp/test.d]ls -l total 32 -rw-r--r-- 1 root other 18 Jul 19 21:33 readme.txt -rw-r--r-- 1 root other 22 Jul 19 21:33 readyou.txt [root@SHT_RBT_TB_SERVER:/tmp/test.d] [root@SHT_RBT_TB_SERVER:/tmp/test.d]grep Hello * readme.txt:Hello readme.txt [root@SHT_RBT_TB_SERVER:/tmp/test.d] > [root@SHT_RBT_TB_SERVER:/tmp/test.d]cat readme.txt Hello readme.txt [root@SHT_RBT_TB_SERVER:/tmp/test.d]cat readyou.txt Good bye readyou.txt [root@SHT_RBT_TB_SERVER:/tmp/test.d]
Type "grep Hello" *" at a telnet command prompt to find any files in the current directory that contain the text Hello" in them
-
15
Appendix UNIX COMMAND - grep
USAGE
The grep command finds lines in files that match specified text patterns. Simply type
"grep "text" filenames" at a telnet command prompt and replace "text" with the word or
phrase you want to search for, and replace filenames with the files you want to search in.
To search all files in the current directory, simply replace filenames with *.
[root@SHT_RBT_TB_SERVER:/]ps -ef|grep LISTENER oracle 425 1 0 Jun 25 ? 0:58 /data/oracle/product/9201/bin/tnslsnr LISTENER -inherit root 27912 27745 0 21:35:44 pts/1 0:00 grep LISTENER [root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/]ps -ef|grep LISTENER | grep -v grep oracle 425 1 0 Jun 25 ? 0:58 /data/oracle/product/9201/bin/tnslsnr LISTENER -inherit [root@SHT_RBT_TB_SERVER:/]
Type ps ef|grep LISTENER at a telnet command prompt to find the process name in the current running process that contain the oracle
Listener in them.
[root@SHT_RBT_TB_SERVER:/]ps -ef|grep java root 27245 1 0 Jul 18 ? 5:38 /usr/local/jdk1.5.0_04/bin/java -Djava.util.logging.manager=org.apache.juli.Cla root 27943 27745 0 21:38:01 pts/1 0:00 grep java root 26384 1 0 Jul 18 ? 0:50 /usr/local/jdk1.5.0_04/bin/java -Djava.util.logging.manager=org.apache.juli.Cla [root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/]ps -ef|grep java|grep -v grep root 27245 1 0 Jul 18 ? 5:38 /usr/local/jdk1.5.0_04/bin/java -Djava.util.logging.manager=org.apache.juli.Cla root 26384 1 0 Jul 18 ? 0:50 /usr/local/jdk1.5.0_04/bin/java -Djava.util.logging.manager=org.apache.juli.Cla [root@SHT_RBT_TB_SERVER:/]
-
16
Appendix UNIX COMMAND - grep
USAGE
The grep command finds lines in files that match specified text patterns. Simply type "grep
"text" filenames" at a telnet command prompt and replace "text" with the word or phrase
you want to search for, and replace filenames with the files you want to search in. To
search all files in the current directory, simply replace filenames with *.
[root@SHT_RBT_TB_SERVER:/]ps -ef|grep java|grep -v grep|wc -l 2 [root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/]ps -ef|grep java|wc -l 3
Type ps ef|grep LISTENER |wc l at a telnet command prompt to find total counts of the process name in the current running
process that contain the oracle Listener in them.
[root@SHT_RBT_TB_SERVER:/]ps -ef|grep java|grep -v grep|wc -l 2 [root@SHT_RBT_TB_SERVER:/]ps -ef|grep java|wc -l 3 [root@SHT_RBT_TB_SERVER:/]ps -ef|grep oracle|wc -l 61 [root@SHT_RBT_TB_SERVER:/]ps -ef|grep oracle|grep -v grep|wc -l 60
USAGE
The wc command - display a count of lines,
Words and characters in a file
-
17
Appendix UNIX COMMAND - kill
USAGE
The kill command execute terminate or signal processes.
The kill utility sends a signal to the process or processes
specified by each PID operand
[root@SHT_RBT_TB_SERVER:/etc/rc3.d]ps -ef|grep dmi root 28240 1 0 22:00:19 ? 0:00 /usr/lib/dmi/dmispd root 28304 27745 0 22:03:47 pts/1 0:00 grep dmi [root@SHT_RBT_TB_SERVER:/etc/rc3.d]ps -ef|grep dmi|grep -v grep root 28240 1 0 22:00:19 ? 0:00 /usr/lib/dmi/dmispd [root@SHT_RBT_TB_SERVER:/etc/rc3.d]ps -ef|grep dmi|grep -v grep|awk '{print $2}' 28240
Type kill -9 `ps -ef|grep "PROCESS_NAME"|grep -v grep|awk '{print $2}'` at a telnet command prompt to stop process once using awk/grep.
> kill -9 `ps -ef|grep dmi|grep -v grep|awk '{print $2}'`
-
18
Appendix UNIX COMMAND head
USAGE
The head command - display first few lines of files. The head utility copies the first number of line
s of each filename to the standard output. If no filename is given, head copies lines from the
standard input. The default value of number is 10 lines.
[root@SHT_RBT_TB_SERVER:/] head -1 /etc/vfstab #device device mount FS fsck mount mount [root@SHT_RBT_TB_SERVER:/] [root@SHT_RBT_TB_SERVER:/] head -2 /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options [root@SHT_RBT_TB_SERVER:/]
[root@SHT_RBT_TB_SERVER:/] head /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # fd - /dev/fd fd - no - /proc - /proc proc - no - /dev/dsk/c1t0d0s1 - - swap - no - /dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 / ufs 1 no - /dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s3 /data ufs 2 yes - /dev/dsk/c1t1d0s3 /dev/rdsk/c1t1d0s3 /DATA ufs 2 yes - swap - /tmp tmpfs - yes -
Type head -1 /etc/vfstab at a telnet command prompt to see only one line.
-
19
Appendix UNIX COMMAND tail
# tail -1 /var/adm/messages Jul 19 21:53:38 SHT_RBT_TB_SERVER last message repeated 1 time # # tail -2 /var/adm/messages Jul 19 21:53:26 SHT_RBT_TB_SERVER /usr/lib/snmp/snmpdx: [ID 702911 daemon.error] unable to get my IP address: gethostbyname(SHT_RBT_TB_SERVER) failed [h_errno: host not found(1)] Jul 19 21:53:38 SHT_RBT_TB_SERVER last message repeated 1 time #
Type tail -1 /var/adm/messages at a telnet command prompt to see only one line.
# tail -f /var/adm/messages Jul 18 15:26:31 SHT_RBT_TB_SERVER su: [ID 810491 auth.crit] 'su root' failed for prbt on /dev/pts/37 Jul 19 21:53:26 SHT_RBT_TB_SERVER /usr/lib/snmp/snmpdx: [ID 702911 daemon.error] unable to get my IP address: gethostbyname(SHT_RBT_TB_SERVER) failed [h_errno: host not found(1)] Jul 19 21:53:38 SHT_RBT_TB_SERVER last message repeated 1 time
USAGE
The tail command - deliver the last part of a file. The tail utility copies the named file to the
standard out-put beginning at a designated place. If no file is named, the standard input is
used.
Type tail -f /var/adm/messages at a telnet command prompt to see running status for monitoring.
it may be used to monitor the growth of a file that is being written by some other process
-
20
Appendix UNIX COMMAND more
[root@SHT_RBT_TB_SERVER:/temp]more -4 check.sh #! /bin/sh # PATH=$PATH:/opt/nmstx/bin:/opt/nms/bin:/opt/nms/hotswap/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nms/lib:/opt/nms/hotswap/lib:/opt/nmstx/lib --More--(2%) [root@SHT_RBT_TB_SERVER:/temp]more -4 check.sh #! /bin/sh # PATH=$PATH:/opt/nmstx/bin:/opt/nms/bin:/opt/nms/hotswap/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nms/lib:/opt/nms/hotswap/lib:/opt/nmstx/lib export PATH export LD_LIBRARY_PATH OSMESSAGE () { echo "(1). Systems" echo "-----------------------------------------------------------------------------" echo "[HOST NAME] hostname: "`hostname` --More--(5%)
Type "more -4 /temp/check.sh" to display the shell script source code
USAGE
The move command displays the contents of files one screenful at a time. If you would like to
display the whole file without pausing, use cat.
-
21
Appendix UNIX COMMAND tar
Type "tar cvf temp_backup.tar temp" at a telnet command prompt to
archive the files in the temp directory to a tar format file called
temp_backup.tar. You could also type "tar xvf temp_backup.tar" at a
telnet command prompt to extract into the current directory the files in
the archive temp_backup.tar.
USAGE
The tar command copies a file or files to or from an archive. To put all the files in a directory into
one tar format file, simply type "tar cvf tarfile directory" at a telnet command prompt and
replace tarfile with the name you want to call your archived file, and replace directory with the
name of the directory that contains the files you want to tar.
To extract the files fram a tar format archive, simply type "tar xvf tarfile" at a telnet command
prompt and replace tarfile with the name of the archived file you are extracting.
-
22
Appendix UNIX COMMAND tar
[root@SHT_RBT_TB_SERVER:/]tar -cvf temp_backup.tar ./temp a ./temp/ 0K a ./temp/check.sh 7K a ./temp/oracle.check.sh 1K a ./temp/check.sh.org 6K a ./temp/MCP_GROUP_2008.07.15.44.log 108K a ./temp/check.scp.monitor.sh 5K a ./temp/SCP_GROUP_2008.07.15.44.log 182K a ./temp/MCP_GROUP_2008.07.16.48.log 115K a ./temp/.metadata 1K a ./temp/check.mcp.monitor.sh 2K a ./temp/SCP_GROUP_2008.07.16.48.log 185K a ./temp/MCP_GROUP_2008.07.16.53.log 116K a ./temp/MCP_GROUP_2008.07.28.52.log 116K a ./temp/SCP_GROUP_2008.07.28.52.log 173K a ./temp/MCP_GROUP_2008.08.05.14.log 115K a ./temp/show_sar48.log 0K a ./temp/test.txt 1K a ./temp/SCP_GROUP_2008.10.08.10.log 171K a ./temp/MCP_GROUP_2008.10.08.18.log 116K a ./temp/MCP_GROUP_2009.01.15.46.log 115K a ./temp/MCP_GROUP_2009.03.13.48.log 115K a ./temp/SCP_GROUP_2009.03.13.51.log 170K a ./temp/pfiles_check_quick.sh 1K a ./temp/MCP_GROUP_2009.07.05.41.log 118K a ./temp/digi-oracle.dmp 311K
Create archive files using cvf option
TIP!!!
Do not use full path for source directory,
when you create tar file.
-
23
Appendix UNIX COMMAND tar
[root@SHT_RBT_TB_SERVER:/]mv ./temp_backup.tar ./temp/ [root@SHT_RBT_TB_SERVER:/temp]tar -xvf temp_backup.tar x ./temp, 0 bytes, 0 tape blocks x ./temp/check.sh, 6641 bytes, 13 tape blocks x ./temp/oracle.check.sh, 671 bytes, 2 tape blocks x ./temp/check.sh.org, 5975 bytes, 12 tape blocks x ./temp/MCP_GROUP_2008.07.15.44.log, 109629 bytes, 215 tape blocks x ./temp/check.scp.monitor.sh, 5099 bytes, 10 tape blocks x ./temp/SCP_GROUP_2008.07.15.44.log, 185469 bytes, 363 tape blocks x ./temp/MCP_GROUP_2008.07.16.48.log, 117074 bytes, 229 tape blocks x ./temp/.metadata, 1 bytes, 1 tape blocks x ./temp/check.mcp.monitor.sh, 1712 bytes, 4 tape blocks x ./temp/SCP_GROUP_2008.07.16.48.log, 188438 bytes, 369 tape blocks x ./temp/MCP_GROUP_2008.07.16.53.log, 118677 bytes, 232 tape blocks x ./temp/MCP_GROUP_2008.07.28.52.log, 118045 bytes, 231 tape blocks x ./temp/SCP_GROUP_2008.07.28.52.log, 176791 bytes, 346 tape blocks x ./temp/MCP_GROUP_2008.08.05.14.log, 117415 bytes, 230 tape blocks x ./temp/show_sar48.log, 0 bytes, 0 tape blocks x ./temp/test.txt, 400 bytes, 1 tape blocks x ./temp/SCP_GROUP_2008.10.08.10.log, 174565 bytes, 341 tape blocks x ./temp/MCP_GROUP_2008.10.08.18.log, 118648 bytes, 232 tape blocks x ./temp/MCP_GROUP_2009.01.15.46.log, 116879 bytes, 229 tape blocks x ./temp/MCP_GROUP_2009.03.13.48.log, 117304 bytes, 230 tape blocks x ./temp/SCP_GROUP_2009.03.13.51.log, 173847 bytes, 340 tape blocks x ./temp/pfiles_check_quick.sh, 324 bytes, 1 tape blocks x ./temp/MCP_GROUP_2009.07.05.41.log, 120435 bytes, 236 tape blocks x ./temp/digi-oracle.dmp, 318464 bytes, 622 tape blocks
Extract archive files using xvf option
TIP!!!
If you dont want to see extracting whole file list, you can use only xf option, not -v .
TIP!!!
Do not use full path for source directory,
when you create tar file.
-
24
Appendix UNIX COMMAND zip
[root@SHT_RBT_TB_SERVER:/temp] zip temp_backup.tar.zip temp_backup.tar test.txt adding: temp_backup.tar (deflated 89%) adding: test.txt (deflated 62%) [root@SHT_RBT_TB_SERVER:/temp] ls -la temp_backup.tar.zip -rw-r--r-- 1 root other 254663 Jul 20 00:08 temp_backup.tar.zip [root@SHT_RBT_TB_SERVER:/temp] file temp_backup.tar.zip temp_backup.tar.zip: ZIP archive
ZIP command Example
Type "zip temp_backup.tar.zip temp_backup test.txt" at a telnet
command prompt to compress and archive the files called
temp_backup.tar and test.txt into the file called temp_backup.tar.zip
USAGE
The zip command compresses a file or list of files into a zip format archive file. Simply type "zip
zipfile file1 file2 file3" at a telnet command prompt and replace zipfile with the name you want
to use for your compressed zip archive file, and replace fileX with the name of the file(s) you
want to compress into the zip archive.
[root@SHT_RBT_TB_SERVER:/temp] zip -rm test_mode ./test.d/test1.txt adding: test.d/test1.txt (deflated 62%) [root@SHT_RBT_TB_SERVER:/temp] zip -rm test_mode ./test.d/test2.txt adding: test.d/test2.txt (deflated 62%) [root@SHT_RBT_TB_SERVER:/temp] zip -rm test_mode ./test.d/test3.txt adding: test.d/test3.txt (deflated 62%)
-
25
Appendix UNIX COMMAND unzip
[root@SHT_RBT_TB_SERVER:/temp] zip -v temp_backup.tar.zip zip info: local extra (21 bytes) != central extra (13 bytes): temp_backup.tar zip info: local extra (21 bytes) != central extra (13 bytes): test.txt [root@SHT_RBT_TB_SERVER:/temp] zip -v test_mode.zip zip info: local extra (21 bytes) != central extra (13 bytes): test.d/test1.txt zip info: local extra (21 bytes) != central extra (13 bytes): test.d/test2.txt zip info: local extra (21 bytes) != central extra (13 bytes): test.d/test3.txt
UNZIP COMMAND Example
Type "unzip temp_backup.tar.zip" at a telnet command prompt to
extract the archive called temp_backup.tar and test.txt.
USAGE
The unzip command extracts a zip format archive file. This command is compatible with pkzip
files from a PC. Simply type "unzip zipfile" at a telnet command prompt and replace zipfile with
the name of your zip format archive file
[root@SHT_RBT_TB_SERVER:/temp] unzip test_mode.zip Archive: test_mode.zip inflating: test.d/test1.txt inflating: test.d/test2.txt inflating: test.d/test3.txt
-
26
Appendix UNIX COMMAND cat
CAT COMMAND Example
Type cat /etc/vfstab" at a telnet command prompt to prints file on your terminal.
USAGE The cat command concatenate and display files. The cat utility reads each file in sequence and writes it on the standard output.
[root@SHT_RBT_TB_SERVER:/temp] cat /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # fd - /dev/fd fd - no - /proc - /proc proc - no - /dev/dsk/c1t0d0s1 - - swap - no - /dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 / ufs 1 no - /dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s3 /data ufs 2 yes - /dev/dsk/c1t1d0s3 /dev/rdsk/c1t1d0s3 /DATA ufs 2 yes - swap - /tmp tmpfs - yes -
-
27
Appendix UNIX COMMAND cat
CAT COMMAND Example HOW TO CLEAR LOG FILE CONTENTS USING CAT COMMAND
[root@SHT_RBT_TB_SERVER:/var/adm] cat /dev/null > utmpx [root@SHT_RBT_TB_SERVER:/var/adm] cat /dev/null > wtmpx [root@SHT_RBT_TB_SERVER:/var/adm] ls -l total 50 -r--r--r-- 1 root other 5740 Jul 19 23:27 lastlog drwxr-xr-x 2 adm adm 512 Jun 25 2008 log -rw-r--r-- 1 root root 343 Jul 19 21:55 messages -rw-r--r-- 1 root root 100 Jul 17 21:01 messages.0 -rw-r--r-- 1 root root 122 Jul 6 13:01 messages.1 -rw-r--r-- 1 root root 691 Apr 14 16:24 messages.2 -rw-r--r-- 1 root root 120 Dec 29 2008 messages.3 -rw-r--r-- 1 root bin 0 Jul 20 00:30 utmpx -rw-r--r-- 1 root root 0 Jun 25 2008 vold.log -rw-r--r-- 1 adm adm 0 Jul 20 00:30 wtmpx
Before Status [root@SHT_RBT_TB_SERVER:/var/adm]ls -l -rw-r--r-- 1 root bin 21576 Jul 20 00:13 utmpx -rw-r--r-- 1 root root 0 Jun 25 2008 vold.log -rw-r--r-- 1 adm adm 2579820 Jul 20 00:13 wtmpx
-
28
Appendix UNIX COMMAND du
Du COMMAND Example
Type du sk . and du sk ./* at a telnet command prompt to calculate whole size of file or directory on your terminal.
USAGE
The du command summarize disk usage. The du utility writes to standard output the
size of the file space allocated to, and the size of the file space allocated to
each subdirectory of, the file hierarchy rooted in each of the specified files
[root@SHT_RBT_TB_SERVER:/temp] du -sk . 7407 . [root@SHT_RBT_TB_SERVER:/temp] [root@SHT_RBT_TB_SERVER:/temp] du -sk ./* 120 ./MCP_GROUP_2008.07.15.44.log 128./MCP_GROUP_2008.07.16.48.log . 1282433 ./temp 2272 ./temp_backup.tar 264 ./temp_backup.tar.zip 4 ./test.d 1 ./test.txt 1 ./test_mode.zip [root@SHT_RBT_TB_SERVER:/temp]
TIP!!!
The result 7407 means 7407 Kbytes.
-
29
Appendix UNIX COMMAND find
Find COMMAND Example
Type find . and find . -print at a telnet command prompt to find it on your terminal.
USAGE
The find command find files.
[root@SHT_RBT_TB_SERVER:/temp/test.d]find . -print . ./test1.txt ./test2.txt ./test3.txt ./oracle.check.sh ./check.mcp.monitor.sh [root@SHT_RBT_TB_SERVER:/temp/test.d]find /temp/test.d -print /temp/test.d /temp/test.d/test1.txt /temp/test.d/test2.txt /temp/test.d/test3.txt /temp/test.d/oracle.check.sh /temp/test.d/check.mcp.monitor.sh
-
30
Appendix UNIX COMMAND find
Find COMMAND Example
Type find . print|grep oracle and ls la `find . print|grep oracle` at a telnet command prompt to find it on your terminal.
USAGE
The find command find files.
[root@SHT_RBT_TB_SERVER:/temp] find . -print|grep oracle ./oracle.check.sh ./digi-oracle.dmp ./temp/oracle.check.sh ./temp/digi-oracle.dmp ./test.d/oracle.check.sh
[root@SHT_RBT_TB_SERVER:/temp] ls -la `find . -print|grep oracle` -rw-r--r-- 1 root other 318464 Jul 9 11:27 ./digi-oracle.dmp -rwxrwxrwx 1 root other 671 Jul 15 2008 ./oracle.check.sh -rw-r--r-- 1 root other 318464 Jul 9 11:27 ./temp/digi-oracle.dmp -rwxrwxrwx 1 root other 671 Jul 15 2008 ./temp/oracle.check.sh -rwxr-xr-x 1 root other 671 Jul 20 00:52 ./test.d/oracle.check.sh [root@SHT_RBT_TB_SERVER:/temp]
TIP!!!
Combination of ls command
-
31
Appendix UNIX COMMAND find
Find COMMAND Example
Type find . type f a mtime -1` or find . type f a mtime +1 at a telnet command prompt to find it on your terminal.
USAGE
The find command find files.
[root@SHT_RBT_TB_SERVER:/var/adm]find . -type f -a -mtime -1 ./utmpx ./wtmpx ./messages ./lastlog ./sulog [root@SHT_RBT_TB_SERVER:/var/adm]
[root@SHT_RBT_TB_SERVER:/var/adm]find . -type f -a -mtime +1 ./aculog ./spellhist ./vold.log ./messages.0 ./messages.1 ./messages.2 ./messages.3
TIP!!!
- mtime: True if the file's data was modified
n days ago
-
32
Appendix UNIX COMMAND su
SU COMMAND Example
Type su prbt or su - prbt or su prbt c command args at a telnet command prompt to become another user or execute some command
with another user permission and environment set on your terminal.
USAGE
The su command become super user or another user.
Example 1: Becoming User prbt While Retaining Your Previously Exported Environment To become user prbt while retaining your previously exported environment, execute: # su prbt
Example 2: Becoming User prbt and Changing to prbt's Login Environment To become user prbt but change the environment to what would be expected if prbt had originally logged in, execute: # su - prbt
TIP!!!
-env: If you want to check what its different, Please execute env command at your terminal
-
33
Appendix UNIX COMMAND su
SU COMMAND Example
Type su prbt or su - prbt or su prbt c command args at a telnet command prompt to become another user or execute some command
with another user permission and environment set on your terminal.
USAGE
The su command become super user or another user.
Example 3: Executing command with user prbt's Environment and Permissions To execute command with the temporary environment and per- missions of user prbt, type: # su - prbt -c "command args" # su - prbt -c "df -h " Sun Microsystems Inc. SunOS 5.9 Generic May 2002 Filesystem Size Used Avail Use% Mounted on /dev/dsk/c0t0d0s0 4.9G 2.1G 2.8G 42% / /dev/dsk/c0t0d0s6 4.9G 2.0G 2.8G 41% /usr swap 3.3G 112k 3.2G 1% /var/run swap 3.3G 104k 3.2G 1% /tmp /dev/dsk/c0t0d0s7 20G 18G 2.3G 88% /PRBT
-
34
Appendix UNIX COMMAND split and cat
split COMMAND Example
The split utility reads file and writes it in linecount-line pieces into a set of
output-files on your terminal.
USAGE
The split command split a file into pieces
[EXAMPLE] [root@SHT_RBT_TB_SERVER:/temp] ls -la temp_backup.tar -rw-r--r-- 1 root other 2312192 Jul 19 23:53 temp_backup.tar [root@SHT_RBT_TB_SERVER:/temp] split -b 1m ./temp_backup.tar temp_backup_ [root@SHT_RBT_TB_SERVER:/temp] ls -la temp_backup_* -rw-r--r-- 1 root other 1048576 Jul 23 19:18 temp_backup_aa -rw-r--r-- 1 root other 1048576 Jul 23 19:18 temp_backup_ab -rw-r--r-- 1 root other 215040 Jul 23 19:18 temp_backup_ac [root@SHT_RBT_TB_SERVER:/temp]
[root@SHT_RBT_TB_SERVER:/temp] ls -l temp_backup* -rw-r--r-- 1 root other 1048576 Jul 23 19:18 temp_backup_aa -rw-r--r-- 1 root other 1048576 Jul 23 19:18 temp_backup_ab -rw-r--r-- 1 root other 215040 Jul 23 19:18 temp_backup_ac [root@SHT_RBT_TB_SERVER:/temp] cat temp_backup_* > temp_backup.tar [root@SHT_RBT_TB_SERVER:/temp] ls -la temp_backup* -rw-r--r-- 1 root other 2312192 Jul 24 11:40 temp_backup.tar -rw-r--r-- 1 root other 1048576 Jul 23 19:18 temp_backup_aa -rw-r--r-- 1 root other 1048576 Jul 23 19:18 temp_backup_ab -rw-r--r-- 1 root other 215040 Jul 23 19:18 temp_backup_ac
FILE SPLIT
FILE MERGE
-
35
Appendix UNIX COMMAND crontab
crontab COMMAND
Type crontab -l to display current crontab, crontab -e to edit it and crontab -r to remove it.
USAGE
The crontab command maintains crontab files for individual users to execute
commands on specified date and time.
Format of crontab files: A crontab file has six fields. The 6th field is the command and the other five fields are date/time on which the command will execute. 1st field: Minute (0-59) 2nd field: Hour (0-23) 3rd field: Day of the month (1-31) 4th field: Month of the year (1-12) 5th field: Day of the week (0-6 with 0=Sunday) * (asterisk) means all legal values
Location of crontab files For Solaris crontab files: /var/spool/cron/crontabs/* Log file: /var/cron/log For Linux crontab files: /var/spool/cron/*
WARNING!!!
Do NOT edit these files directly!!!
-
36
Appendix UNIX COMMAND crontab
crontab COMMAND Example
Type crontab -l to display current crontab, crontab -e to edit it with current EDITOR and crontab -r to remove it.
USAGE
The crontab command maintains crontab files for individual users to execute
commands on specified date and time.
Example 1: Append the time of crontab activation on every Sunday and Wednesday 09:30 am. # crontab e 30 9 * * 0,3 date >> /tmp/crontest.log # touch /tmp/crontest.log After two weeks, check the result. # cat /tmp/crontest.log Wed Aug 5 09:30:01 KST 2009 Sun Aug 9 09:30:01 KST 2009 Wed Aug 12 09:30:01 KST 2009 Sun Aug 16 09:30:01 KST 2009
TIP!!!
If crontab e does not show proper screen, check EDITOR (echo $EDITOR) and set it vi as follows;
# EDITOR=vi
# export EDITOR
# echo $EDITOR
vi
-
37
Appendix Oracle DBMS startup/shutdown
COMMAND
Example 1: To startup Oracle # su - oracle Sun Microsystems Inc. SunOS 5.9 Generic May 2002 $ sqlplus '/as sysdba' SQL*Plus: Release 9.2.0.1.0 - Production on Mon Feb 2 22:29:56 2009 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 320308312 bytes Fixed Size 730200 bytes Variable Size 285212672 bytes Database Buffers 33554432 bytes Redo Buffers 811008 bytes Database mounted. Database opened. SQL> SQL> exit Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production
-
38
Appendix Oracle DBMS startup/shutdown
COMMAND
$ lsnrctl start LSNRCTL for Solaris: Version 9.2.0.1.0 - Production on 02-FEB-2009 22:30:27 Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved. Starting /ORACLE/app/oracle/product/920/bin/tnslsnr: please wait... TNSLSNR for Solaris: Version 9.2.0.1.0 - Production System parameter file is /ORACLE/app/oracle/product/920/network/admin/listener.ora Log messages written to /ORACLE/app/oracle/product/920/network/log/listener.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HOSTNAME)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Solaris: Version 9.2.0.1.0 - Production Start Date 02-FEB-2009 22:30:27 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security OFF SNMP OFF Listener Parameter File /ORACLE/app/oracle/product/920/network/admin/listener.ora Listener Log File /ORACLE/app/oracle/product/920/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HOSTNAME)(PORT=1521))) Services Summary... Service SVC" has 1 instance(s). Instance SVC", status UNKNOWN, has 1 handler(s) for this service... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
-
39
Appendix Oracle DBMS startup/shutdown
COMMAND
Example 2: To shutdown Oracle # su - oracle Sun Microsystems Inc. SunOS 5.9 Generic May 2002 $ lsnrctl stop LSNRCTL for Solaris: Version 9.2.0.1.0 - Production on 02-FEB-2009 22:29:10 Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC))) The command completed successfully $ sqlplus '/as sysdba' SQL*Plus: Release 9.2.0.1.0 - Production on Mon Feb 2 22:29:26 2009 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> exit Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production
-
Appendix UNIX COMMAND - pkgadd
Type "pkgadd -d lsof-4.80-sol9-sparc-local " to install new
version of lsof in the server. [root@SHT_RBT_TB_SERVER:/temp]pkgadd -d lsof-4.80-sol9-sparc-local The following packages are available: 1 SMClsof lsof (sparc) 4.80 Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: all SELECT all Processing package instance from lsof (sparc) 4.80 Vic Abell Using as the package base directory. ## Processing package information. ## Processing system information. 5 package pathnames are already properly installed. ## Verifying disk space requirements. ## Checking for conflicts with packages already installed. ## Checking for setuid/setgid programs.
-
The following files are being installed with setuid and/or setgid permissions: /usr/local/bin/lsof /usr/local/bin/sparcv7/lsof /usr/local/bin/sparcv9/lsof Do you want to install these as setuid/setgid files [y,n,?,q] y SELECT Y = YES Installing lsof as ## Installing part 1 of 1. /usr/local/bin/lsof /usr/local/bin/sparcv7/lsof /usr/local/bin/sparcv9/lsof /usr/local/doc/lsof/00.README.FIRST /usr/local/doc/lsof/00CREDITS /usr/local/doc/lsof/00DCACHE /usr/local/doc/lsof/00DIALECTS /usr/local/doc/lsof/00DIST /usr/local/doc/lsof/00FAQ /usr/local/doc/lsof/00LSOF-L /usr/local/doc/lsof/00MANIFEST /usr/local/doc/lsof/00PORTING /usr/local/doc/lsof/00QUICKSTART /usr/local/doc/lsof/00README /usr/local/doc/lsof/00TEST /usr/local/doc/lsof/00XCONFIG /usr/local/doc/lsof/lsof.man /usr/local/man/man8/lsof.8 [ verifying class ] Installation of was successful.
Appendix UNIX COMMAND - pkgadd
-
[root@SHT_RBT_TB_SERVER:/]pkginfo -i system IPLTadcon Administration Server Console system IPLTadman Administration Server Documentation system IPLTadmin Administration Server system IPLTcons Console Client Base system IPLTdscon Directory Server Console system IPLTdsman Directory Server Documentation system IPLTdsr Directory Server (root) system IPLTdsu Directory Server (usr) system IPLTjss Network Security Services for Java system IPLTnls Nationalization Languages and Localization Support system IPLTnspr Portable Runtime Interface system IPLTnss Network Security Services --------------------------------------------------------------- system SUNWzip The Info-Zip (zip) compression utility system SUNWzlib The Zip compression library system SUNWzlibx The Zip compression library (64-bit) system SUNWzsh Z shell (zsh) application SUNWzuluc Sun XVR-4000 Graphics Configuration Software (64-bit) system SUNWzulur Sun XVR-4000 Graphics System Software (Root) (64-bit) application SUNWzuluw Sun XVR-4000 Graphics Window System Support (64-bit) system SUNWzulux Sun XVR-4000 Graphics System Software/Device Driver (64-bit) system TSIpgx PGX32 (Raptor GFX) System Software/Device Driver v3.0 application TSIpgxw PGX32 (Raptor GFX) X Window System Support v3.0 system TSIpgxx PGX32 (Raptor GFX) System Software/Device Driver v3.0 (64-bit)
Appendix UNIX COMMAND - pkginfo
Type "pkginfo -i" to check lsof package information
-
[root@SHT_RBT_TB_SERVER:/] pkgrm SMClsof The following package is currently installed: SMClsof lsof (sparc) 4.80 Do you want to remove this package? [y,n,?,q] y ## Removing installed package instance ## Verifying package dependencies. ## Processing package information. ## Removing pathnames in class /usr/local/man/man8/lsof.8 /usr/local/man/man8 /usr/local/man /usr/local/doc/lsof/lsof.man /usr/local/doc/lsof/00XCONFIG /usr/local/doc/lsof/00TEST /usr/local/doc/lsof/00README /usr/local/doc/lsof/00QUICKSTART /usr/local/doc/lsof/00PORTING /usr/local/doc/lsof/00MANIFEST /usr/local/doc/lsof/00LSOF-L /usr/local/doc/lsof/00FAQ /usr/local/doc/lsof/00DIST /usr/local/doc/lsof/00DIALECTS /usr/local/doc/lsof/00DCACHE
Appendix UNIX COMMAND - pkgrm
Type "pkgrm" to remove both fully or partially installed
packages in th system
[root@SHT_RBT_TB_SERVER:/temp]pkgadd -d lsof-4.80-sol9-sparc-local The following packages are available: 1 SMClsof lsof (sparc) 4.80
-
/usr/local/doc/lsof/00CREDITS /usr/local/doc/lsof/00.README.FIRST /usr/local/doc/lsof /usr/local/doc /usr/local/bin/sparcv9/lsof /usr/local/bin/sparcv9 /usr/local/bin/sparcv7/lsof /usr/local/bin/sparcv7 /usr/local/bin/lsof /usr/local/bin ## Updating system information. Removal of was successful.
Appendix UNIX COMMAND - pkgrm
-
[root@SHT_RBT_TB_SERVER:/]/usr/local/bin/lsof -i TCP COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME rpcbind 154 root 6u IPv4 0x3000310f270 0t0 TCP *:sunrpc (LISTEN) rpcbind 154 root 7u IPv4 0x3000310f0f0 0t0 TCP *:* (IDLE) inetd 177 root 11u IPv6 0x3000310ef70 0t0 TCP *:time (LISTEN) inetd 177 root 13u IPv6 0x3000310f870 0t0 TCP *:echo (LISTEN) in.telnet 16347 root 2u IPv6 0x300447c81b8 0t98 TCP SHT_RBT_TB_SERVER:telnet->172.18.28.87:3701 (ESTABLISHED) in.telnet 16482 root 0u IPv6 0x3092cd2edb8 0t98 TCP SHT_RBT_TB_SERVER:telnet->172.18.220.7:1561 (ESTABLISHED) sshd 20142 root 6u IPv6 0x30823ca5248 0t157306 TCP SHT_RBT_TB_SERVER:ssh->172.18.28.87:3733 (ESTABLISHED) sshd 20145 drbt 4u IPv6 0x30823ca5248 0t157306 TCP SHT_RBT_TB_SERVER:ssh->172.18.28.87:3733 (ESTABLISHED) in.ftpd 20400 drbt 0u IPv6 0x30046898ac0 0t2071 TCP SHT_RBT_TB_SERVER:ftp->172.18.28.86:2281 (ESTABLISHED) in.ftpd 20400 drbt 1u IPv6 0x30046898ac0 0t2071 TCP SHT_RBT_TB_SERVER:ftp->172.18.28.86:2281 (ESTABLISHED) rlogin 23929 root 5u IPv6 0x309443e9270 0t141038 TCP TB_SERVER:863->SHT_RBT_MCP1_F2:login (ESTABLISHED) rlogin 23930 root 5u IPv6 0x309443e9270 0t141038 TCP TB_SERVER:863->SHT_RBT_MCP1_F2:login (ESTABLISHED) rlogin 23951 root 5u IPv6 0x309443e84f0 0t22934 TCP TB_SERVER:861->SHT_RBT_MCP1_BG1:login (ESTABLISHED) rlogin 23952 root 5u IPv6 0x309443e84f0 0t22934 TCP TB_SERVER:861->SHT_RBT_MCP1_BG1:login (ESTABLISHED) rlogin 23964 root 5u IPv6 0x300542e8058 0t15077 TCP TB_SERVER:860->SHT_RBT_MCP1_BG2:login (ESTABLISHED)
Appendix UNIX COMMAND - lsof
Type "/usr/local/bin/lsof -i TCP" to check Telnet/FTP port that is
opening and processing in the server.
USAGE
Means list open files which allow the system to display a list of all opened files and
processes files.
-
Appendix UNIX COMMAND - rup
USAGE
The rup" command displays the status of a remote host on the local network and the
responses it receives.
Type rup -h" to find out the status of all hosts on the network in alphabetically order by host name.
[root@SHT_RBT_TB_SERVER:/]/usr/bin/rup -h collecting responses... 172.18.98.33.12 up 449 days, 10:28, load average: 0.02, 0.01, 0.01 172.18.98.34.12 up 449 days, 9:10, load average: 0.07, 0.09, 0.11 172.18.98.52.12 up 449 days, 8:46, load average: 0.09, 0.05, 0.05 172.18.98.53.12 up 449 days, 8:44, load average: 0.01, 0.03, 0.04 LOCAL up 10 days, 15:35, load average: 0.30, 0.39, 0.50 SHT_MCP_IVR1 up 448 days, 9:05, load average: 0.00, 0.00, 0.02 SHT_MCP_IVR2 up 448 days, 8:58, load average: 0.00, 0.02, 0.03 SHT_RBT_CMS1 up 449 days, 8:46, load average: 0.09, 0.05, 0.05 SHT_RBT_CMS2 up 449 days, 8:44, load average: 0.01, 0.03, 0.04 SHT_RBT_IP1_A1 up 447 days, 11:05, load average: 0.04, 0.04, 0.05 SHT_RBT_IP1_A2 up 447 days, 11:21, load average: 0.07, 0.10, 0.12 SHT_RBT_IP2_A1 up 271 days, 10:52, load average: 0.00, 0.01, 0.02 SHT_RBT_IP2_A2 up 447 days, 10:16, load average: 0.03, 0.05, 0.05 SHT_RBT_MCP1_BG up 449 days, 10:12, load average: 0.06, 0.09, 0.09 SHT_RBT_MCP1_BG up 449 days, 10:11, load average: 0.16, 0.11, 0.10 SHT_RBT_MCP1_D1 up 4 days, 5:46, load average: 0.33, 0.34, 0.35 SHT_RBT_MCP1_D2 up 4 days, 8:17, load average: 0.00, 0.00, 0.00 S HT_RBT_SCP2_B up 448 days, 10:41, load average: 0.04, 0.04, 0.04 SHT_RBT_SCP2_O up 448 days, 10:13, load average: 0.21, 0.19, 0.19 SHT_RBT_TB_IP up 782 days, 19:28, load average: 0.02, 0.02, 0.02 TB-SERVER up 10 days, 15:35, load average: 0.30, 0.39, 0.50
-
Type rup -l" to display a list of all hosts on the network according to load average
Appendix UNIX COMMAND - rup
[root@SHT_RBT_TB_SERVER:/]/usr/bin/rup -l collecting responses... SHT_MCP_IVR1 up 448 days, 9:06, load average: 0.00, 0.00, 0.02 SHT_RBT_MCP1_O up 449 days, 10:17, load average: 0.00, 0.01, 0.01 SHT_RBT_MCP1_D2 up 4 days, 8:18, load average: 0.00, 0.00, 0.00 SHT_RBT_MCP1_F1 up 449 days, 10:29, load average: 0.00, 0.01, 0.01 SHT_RBT_MCPTB_D up 19 days, 23:44, load average: 0.01, 0.01, 0.01 TSM1_eri1 up 782 days, 19:30, load average: 0.02, 0.02, 0.02 SHT_RBT_TB_IP up 782 days, 19:30, load average: 0.02, 0.02, 0.02 SHT_RBT_SCP2_A up 448 days, 10:48, load average: 0.02, 0.02, 0.03 SHT_RBT_SCP2_B up 448 days, 10:42, load average: 0.02, 0.04, 0.04 SHT_RBT_MCP1_W1 up 449 days, 10:09, load average: 0.02, 0.07, 0.08 SHT_RBT_CMS1 up 449 days, 8:47, load average: 0.03, 0.04, 0.05 SHT_RBT_CMS2 up 449 days, 8:45, load average: 0.03, 0.03, 0.04 SHT_RBT_IP2_A2 up 447 days, 10:17, load average: 0.05, 0.05, 0.05 SHT_RBT_SCP1_A up 448 days, 11:19, load average: 0.07, 0.05, 0.04 SHT_RBT_MCP1_W2 up 449 days, 10:06, load average: 0.07, 0.08, 0.08 172.18.98.50.12 up 449 days, 10:06, load average: 0.07, 0.08, 0.08 SHT_RBT_MCP1_BG up 449 days, 10:12, load average: 0.10, 0.11, 0.10 172.18.98.58.12 up 449 days, 10:12, load average: 0.10, 0.11, 0.10 SHT_RBT_IP1_A2 up 447 days, 11:22, load average: 0.11, 0.11, 0.12 SHT_RBT_SCP1_B up 448 days, 11:15, load average: 0.12, 0.07, 0.06 SHT_RBT_SCP2_O up 448 days, 10:14, load average: 0.16, 0.18, 0.19 SHT_RBT_SCP1_O up 448 days, 10:14, load average: 0.27, 0.22, 0.21 TB-SERVER up 10 days, 15:37, load average: 0.30, 0.37, 0.48 LOCAL up 10 days, 15:37, load average: 0.30, 0.37, 0.48 SHT_RBT_MCP1_D1 up 4 days, 5:48, load average: 0.32, 0.34, 0.35
-
Type rup -t" to display a list of all hosts on the network sort by machine up time.
Appendix UNIX COMMAND - rup
[root@SHT_RBT_TB_SERVER:/]/usr/bin/rup -t collecting responses... SHT_RBT_TB_IP up 782 days, 20:19, load average: 0.00, 0.02, 0.02 SHT_RBT_MCP1_F1 up 449 days, 11:19, load average: 0.00, 0.01, 0.01 SHT_RBT_MCP1_O up 449 days, 11:07, load average: 0.00, 0.00, 0.01 SHT_RBT_MCP1_BG up 449 days, 11:03, load average: 0.04, 0.04, 0.05 SHT_RBT_MCP1_BG up 449 days, 11:02, load average: 0.03, 0.07, 0.08 SHT_RBT_MCP1_W1 up 449 days, 10:59, load average: 0.08, 0.07, 0.08 SHT_RBT_MCP1_W2 up 449 days, 10:56, load average: 0.05, 0.05, 0.07 SHT_RBT_MCP1_F2 up 449 days, 10:01, load average: 0.01, 0.03, 0.04 SHT_RBT_CMS1 up 449 days, 9:37, load average: 0.03, 0.04, 0.05 SHT_RBT_CMS2 up 449 days, 9:35, load average: 0.01, 0.04, 0.04 SHT_RBT_SCP1_A up 448 days, 12:09, load average: 0.04, 0.05, 0.05 SHT_RBT_SCP1_B up 448 days, 12:05, load average: 0.10, 0.05, 0.05 SHT_RBT_SCP2_A up 448 days, 11:38, load average: 0.00, 0.01, 0.02 SHT_RBT_SCP2_B up 448 days, 11:32, load average: 0.00, 0.00, 0.02 SHT_MCP_IVR1 up 448 days, 9:56, load average: 0.00, 0.01, 0.02 SHT_MCP_IVR2 up 448 days, 9:49, load average: 0.00, 0.04, 0.07 SHT_RBT_IP1_A2 up 447 days, 12:12, load average: 0.10, 0.16, 0.14 SHT_RBT_IP1_A1 up 447 days, 11:56, load average: 0.08, 0.05, 0.05 SHT_RBT_IP2_A2 up 447 days, 11:07, load average: 0.02, 0.05, 0.05 SHT_RBT_IP2_A1 up 271 days, 11:43, load average: 0.01, 0.01, 0.01 SHT_RBT_MCPTB_D up 20 days, 34 mins, load average: 0.01, 0.01, 0.01 TB-SERVER up 10 days, 16:26, load average: 0.61, 0.51, 0.54 LOCAL up 10 days, 16:26, load average: 0.61, 0.51, 0.54 SHT_RBT_MCP1_D2 up 4 days, 9:08, load average: 0.00, 0.00, 0.00 SHT_RBT_MCP1_D1 up 4 days, 6:37, load average: 0.27, 0.27, 0.30
-
Appendix UNIX COMMAND - iostat
USAGE
The iostat" command used for monitoring system input/output device by observing by
time for which devices are active.
It can generates reports that can be used to
change system configuration to better
balance the input/output load between
physical disks
Type iostat " to display a single history since boot report for all CPU and devices.
[root@JB_PRBT_IP1_O:/]iostat tty sd0 sd1 sd30 nfs1 cpu tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id 0 73 611 35 2 0 0 0 0 0 1 0 0 0 1 1 4 94
[root@JB_PRBT_IP1_O:/]iostat -d 2 sd0 sd1 sd30 nfs1 kps tps serv kps tps serv kps tps serv kps tps serv 611 35 2 0 0 0 0 0 1 0 0 0 2 3 19 0 0 0 0 0 0 0 0 0 12 2 10 0 0 0 0 0 0 0 0 0 13 3 10 0 0 0 0 0 0 0 0 0
Type iostat d 2 " to display a continuous device report at 2 seconds intervals.
Type iostat d 5 " to display a continuous device report at 5 seconds intervals.
-
Appendix UNIX COMMAND - iostat
Type iostat -d 2 6" to display 6 reports at 2 seconds interval for all devices.
[root@JB_PRBT_IP1_O:/]iostat -d 2 6 sd0 sd1 sd30 nfs1 kps tps serv kps tps serv kps tps serv kps tps serv 611 35 2 0 0 0 0 0 1 0 0 0 4 0 8 0 0 0 0 0 0 0 0 0 17 4 10 0 0 0 0 0 0 0 0 0 12 2 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 2 10 0 0 0 0 0 0 0 0 0
[root@JB_PRBT_IP1_O:/]iostat -d 5 5 sd0 sd1 sd30 nfs1 kps tps serv kps tps serv kps tps serv kps tps serv 610 35 2 0 0 0 0 0 1 0 0 0 7 1 9 0 0 0 0 0 0 0 0 0 1661 77 2 0 0 0 0 0 0 0 0 0 10925 660 1 0 0 0 0 0 0 0 0 0 10688 659 1 0 0 0 0 0 0 0 0 0
Type iostat d 5 5 " to display 5 reports at 5 seconds interval for all devices.
TTY info and CPU info is
not shown.
-
Appendix UNIX COMMAND - iostat
Type iostat -en to check hardware error count in the system
[root@JB_PRBT_IP1_O:/]iostat -en ---- errors --- s/w h/w trn tot 0 0 0 0 c1t0d0 0 0 0 0 c1t1d0 1 0 0 1 c0t0d0 0 0 0 0 OMP:vold(pid484)
[root@JB_PRBT_IP1_O:/]iostat -en ---- errors --- s/w h/w trn tot 1 126 27 154 c1t0d0 0 0 0 0 c1t1d0 1 0 0 1 c0t0d0 0 0 0 0 OMP:vold(pid484)
NOT OK
OK
Type iostat 5 5 " to display 5 reports at 5 seconds interval for all devices. JB_PRBT_IP1_O:/PRBT/bin> iostat 5 5 tty sd0 sd1 sd30 nfs1 cpu tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id 0 74 614 36 2 0 0 0 0 0 1 0 0 0 1 1 4 94 0 263 88 16 11 0 0 0 0 0 0 0 0 0 1 0 9 90 0 208 58 12 10 0 0 0 0 0 0 0 0 0 1 1 5 93 0 184 64 13 11 0 0 0 0 0 0 0 0 0 0 0 7 93 0 184 100 19 11 0 0 0 0 0 0 0 0 0 1 1 9 89
-
Appendix UNIX COMMAND - vmstat
USAGE
The vmstat" command reports virtual memory statistics of process, virtual memory,
disk, trap and CPU activity.
Type vmstat 120" display a continuous device report at 120 seconds intervals.
[root@JB_PRBT_IP1_O:/]vmstat 120 kthr memory page disk faults cpu r b w swap free re mf pi po fr de sr s0 s1 s3 -- in sy cs us sy id 0 0 0 3509520 563736 77 6 600 0 0 0 0 35 0 0 0 670 626 531 1 1 98 0 0 0 3505360 557544 173 5 1378 0 0 0 0 82 0 0 0 810 739 621 2 1 97 0 0 0 3505360 557392 5 5 0 0 0 0 0 2 0 0 0 565 537 468 0 0 100
[root@JB_PRBT_IP1_O:/]vmstat 5 5 kthr memory page disk faults cpu r b w swap free re mf pi po fr de sr s0 s1 s3 -- in sy cs us sy id 0 0 0 3509512 563736 77 6 600 0 0 0 0 35 0 0 0 670 626 531 1 1 98 0 0 0 3505352 557280 6 6 0 0 0 0 0 2 0 0 0 566 604 477 0 0 100 0 0 0 3505352 558432 907 5 7114 0 0 0 0 312 0 0 0 1529 1433 1058 7 6 87 0 0 0 3505352 558920 1331 5 10978 0 0 0 0 727 0 0 0 2770 2259 1886 10 10 81 0 0 0 3505352 556848 1352 5 11007 0 0 0 0 631 0 0 0 2491 2134 1662 24 9 67
Type vmstat 5 5 " to display 5 data at 5 seconds interval for all devices.
-
Type top" to display a list of all dynamic real-time view of a running system. It can display system summary information as
well as a list of tasks currently
Appendix UNIX COMMAND - top
[root@scs0:/] /usr/local/bin/top load averages: 0.07, 0.06, 0.05 scs0 14:39:45 128 processes: 126 sleeping, 1 stopped, 1 on cpu CPU states: % idle, % user, % kernel, % iowait, % swap Memory: 4.0G real, 2.4G free, 900M swap in use, 6.3G swap free PID USERNAME THR PR NCE SIZE RES STATE TIME FLTS CPU COMMAND 27659 oracle 1 38 0 390M 355M sleep 67:24 0 0.62% oracle 27616 oracle 1 45 0 390M 354M sleep 57:25 0 0.46% oracle 555 prbt 7 58 0 3272K 2456K sleep 586:02 0 0.20% SysAgent.exe 27651 drbt 45 59 0 6000K 5368K sleep 36:43 0 0.20% ssp 315 oracle 11 58 0 388M 337M sleep 87:48 0 0.06% oracle 325 oracle 1 58 0 1.3G 1.2G sleep 488:14 0 0.05% oracle 18486 drbt 4 59 0 440M 8616K sleep 6:27 0 0.05% flexd 1616 root 1 56 0 1920K 1176K cpu00 0:00 0 0.02% top 313 oracle 258 58 0 390M 343M sleep 19:01 0 0.00% oracle 317 oracle 13 59 0 384M 338M sleep 62:05 0 0.00% oracle 319 oracle 1 58 0 381M 340M sleep 23:11 0 0.00% oracle 261 root 1 60 0 1088K 712K sleep 3:57 0 0.00% utmpd 23784 root 27 59 0 23.6M 14.0M sleep 1:30 0 0.00% sopagt 236 root 15 52 0 3328K 2712K sleep 1:11 0 0.00% nscd 825 root 6 49 0 9320K 6320K sleep 1:07 0 0.00% dtsession
-
Knowing is not enough; We must apply.
Willing is not enough; We must do.
Johann Wolfgang von Goethe
Baixaki picture