Solaris 8.0 常用命令解释( 二 )



Memory
prtconf | grep "Memory size"
/* Display Memory Size */

Network Information
ndd /dev/arp arp_cache_report
/* Prints ARP table in cache with IP and Mac address */
netstat -a | grep EST | wc -l
/* Displays number active established connections to the localhost */
netstat -k hme0
/* Undocumented netstat command */
netstat -i
/* Show the TCP/IP network interfaces */
netstat -np
/* Similar to arp -a without name resolution */
netstat -r
/* Show network route table */
netstat -rn
/* Displays routing information but bypasses hostname lookup. */
netstat -a | more
/* Show the state of all sockets */
traceroute
/* Follow the route to the ipaddress */

Network/Tuning
ifconfig eth0 mtu 1500
/* Change MTU of interface */
ifconfig eth0 10.1.1.1 netmask 255.255.255.255
/* Add an Interface */
/sbin/ifconfig hme0:1 inet 10.210.xx.xxx netmask 255.255.0.0 broadcast 10.210.xxx.xxx
/* Virtual Interfaces */
/sbin/ifconfig hme0:1 up
/* Bring virtual interface up */
/usr/sbin/ndd -set /dev/hme adv_100fdx_cap 1
/* Nailling to 100Mbps */
ndd -set /dev/ip ip_addrs_per_if 1-8192
/* To set more than 256 virtual ip addresses. */
ndd -set /dev/tcp tcp_xmit_hiwat 65535
/* Increase TCP-transmitbuffers */
ndd -set /dev/tcp tcp_recv_hiwat 65535
/* Increase TCP-receivebuffers */

Processes
fuser -uc /var
/* Processes that are running from /var */
kill -HUP `ps -ef | grep [p]roccess | awk "{print $2}"`
/* HUP any related process in one step */
pfiles
/* Shows processes" current open files */
pkill -n
/* Kill a process by name */
kill `ps -ef | grep program_name | grep -v grep | cut -f8 -d " "`
/* pkill for solaris 2.6 */
prstat -a
/* An alternative for top command */
/usr/ucb/ps -aux | more
/* Displays CPU % usage for each process in ascending order */
/usr/ucb/ps -auxww | grep
/* Gives the full listing of the process (long listing) */
ps -ef | grep -i| awk "{ print $2 }"
/* Creates list of running PID by */
ps -ef | grep -v "0:00" | more
/* Gives you a list of any process with CPU time more than 0:00 */
ps -ef | more
/* Show all processes running */
ps -fu oracle|grep pmon
/* See which instances of Oracle are running */
/usr/proc/bin/ptree 【Solaris 8.0 常用命令解释】
/* Print the parent/child process "tree" of a process */
/usr/proc/bin/pwdx
/* Print the working directory of a process */
top -b 1
/* Returns the process utilizing the most cpu and quits */

Resource Management
/usr/bin/ldd [filename]
/* List the dynamic dependencies of executable files */
/usr/proc/bin/pmap pid
/* Report address space map a process occupies */

Route Configuration
route add net 128.50.0.0 128.50.1.6 1
/* Adds route to 128.50 network via 128.50.1.6 */
route delete net 128.50.0.0 128.50.1.6
/* Deletes route to 128.50 network */
route get [hostname]
/* Which interface will be used to contact hostname */
route monitor
/* Monitors traffic to the routes */
route flush
/* Removes all entries in the route table */

Searching Items
egrep "patterna|patternb"
/* Search for multiple patterns within the same file */
find . -exec egrep -li "str" {} ;
/* Find a string in files starting cwd */
find / -fstype nfs -prune -o fstype autofs -prune -o -name filename -print
/* Find without traversing NFS mounted file systems */
find . -mtime -1 -type f
/* Find recently modified files */
find / -mtime <# of days>
/* Find files modified during the past # of days */
find . ! -mtime - | /usr/bin/xargs rm -rf
/* Finds and removes files older than specified */
find . -type f -exec grep "" {} ; -print
/* Find files containingwithin directory tree */
find . -type f -print | xargs grep -i [PATTERN]
/* Recursive grep on files */

推荐阅读