您的位置:首页 > 服装鞋帽 > 休闲装 > Solaris管理常用的168条命令

Solaris管理常用的168条命令

luyued 发布于 2011-01-28 00:14   浏览 N 次  

SysAdmin Commands

Debugging

truss executable

truss -f -p

Arp, ethernet trouble shooting

arp -a .

arp -d myhost

Disk Commands

du -k .

du -sk .

du -sk *|sort -k1,1n

du -ad /var | sort -nr

fdformat -d -U

/usr/bin/iostat -E

/bin/mount -F hsfs -o ro /dev/sr0 /cdrom

newfs -Nv /dev/rdsk/c0t0d0s1

prtvtoc /dev/rdsk/c0t0d0s2

quot -af

Driver Parameters

ndd /dev/ip \?

ndd /dev/ip ip_forwarding

ndd -set /dev/ip ip_forwarding 1

File Manipulation

dos2unix | -ascii

split

[vi] : %s/existing/new/g

[vi] :set nu

[vi] :set ts=[num]

File System

cat /dev/null > filename

dd if=/dev/rdsk/… of=/dev/rdsk/… bs=4096

df -k | grep dg| awk ‘{print $6}’ |xargs -n 1 umount

fsck -F ufs /dev/rdsk/c0t0d0s0

fsck -F ufs -y /dev/rdsk/c0t0d0s0

fsck -F ufs -o b=97472 /dev/rdsk/c0t0d0s0

gzip -dc file1.tar.gz | tar xf -

gzip -d -c tarball.tgz | (cd /[dir];tar xf - ) &

ln [-fhns]

ls -la | awk ‘{ print $5,” “,$9 }’ | sort -rn

mount -f pcfs /dev/dsk/c0d0p1 /export/dos

mount -F ufs -o rw,remount /

mount -o remount,logging /spare

pax -rw . /newdir

prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2

tar cvf filename.tar

tar xvf filename.tar

tar cf - . | (cd /newdir ; tar xf -)

/sbin/uadmin x x

zcat [cpio file] | cpio -itmv

zcat ; echo ${FQ_FILENAME%

mailx -H -u

set filec

uuencode [filename] [filename] | mailx -s “Subject” [user to mail]

Hardware

cfgadm

m64config -prconf

m64config -depth 8|24

m64config -res ‘video_mode’

Kernel

/usr/sbin/modinfo

/usr/sbin/modload

/usr/sbin/modunload -i

nm -x /dev/ksyms | grep OBJ | more

/usr/sbin/sysdef

Memory

prtconf | grep Mem

Network Information

ndd /dev/arp arp_cache_report

netstat -a | grep EST | wc -l

netstat -k hme0

netstat -i

netstat -np

netstat -r

netstat -rn

netstat -a | more

traceroute

Network/Tuning

ifconfig eth0 mtu 1500

ifconfig eth0 10.1.1.1 netmask 255.255.255.255

/sbin/ifconfig hme0:1 inet 10.210.xx.xxx netmask 255.255.0.0 broadcast 10.210.xxx.xxx

/sbin/ifconfig hme0:1 up

/usr/sbin/ndd -set /dev/hme adv_100fdx_cap 1

ndd -set /dev/ip ip_addrs_per_if 1-8192

ndd -set /dev/tcp tcp_xmit_hiwat 65535

ndd -set /dev/tcp tcp_recv_hiwat 65535

Processes

fuser -uc /var

kill -HUP `ps -ef | grep [p]roccess | awk ‘{print $2}’`

lsof -i TCP:25

pfiles

pkill -n

kill `ps -ef | grep program_name | grep -v grep | cut -f8 -d ‘ ‘`

prstat -a

/usr/ucb/ps -aux | more

/usr/ucb/ps -auxww | grep

ps -ef | grep -i | awk ‘{ print $2 }’

ps -ef | grep -v “0:00″ | more

ps -ef | more

ps -eo pid,args

ps -fu oracle|grep pmon

/usr/proc/bin/ptree

/usr/proc/bin/pwdx

top -b 1

Resource Management

/usr/bin/ldd [filename]

/usr/proc/bin/pmap pid

Route Configuration

route add net 128.50.0.0 128.50.1.6 1

route change 128.50.0.0 128.50.1.5

route delete net 128.50.0.0 128.50.1.6

route get [hostname]

route monitor

route flush

Searching Items

egrep “patterna|patternb”

find . -exec egrep -li “str” {} \;

find / -fstype nfs -prune -o fstype autofs -prune -o -name filename -print

find . -mtime -1 -type f

find / -mtime

find . ! -mtime - | /usr/bin/xargs rm -rf

find . -type f -exec grep “” {} \; -print

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

find . -type f -print | xargs grep -i [PATTERN]

find / -user

find / | grep [file mask]

find -name “” -exec rm -rf {} \;

find /proc

ls -lR | grep

Security

echo ‘Please go away’ > /etc/nologin

find / -perm -0777 -type d -ls

find / -type f -perm -2000 -print

find / -type f -perm -4000 -print

Set Terminal Options

stty erase ^H

stty erase ^?

stty sane

tput rmacs

Snoop Your Network

snoop -d pcelx0

snoop -o /tmp/mylog pcelx0

snoop -i /tmp/mylog host1 host2

snoop -i /tmp/mylog -v -p101

snoop -i /tmp/mylog -o /tmp/newlog host1

snoop -s 120

snoop -v arp

Swap File

mkfile -v 10m /export/disk1/myswap

mkfile -nv 10m /export/disk1/myswap

Swap Space

swap -s

swap -a /export/disk1/swapfile

swap -d /dev/dsk/c0t0d0s4

swap -l

System Configuration

drvconfig ; disks

/usr/sbin/eeprom auto-boot? false

/usr/sbin/eeprom diag-switch? true

/usr/sbin/eeprom local-mac-address?=true

/usr/sbin/grpck

/usr/sbin/pwck

/usr/sbin/sys-unconfig

System Information and Monitoring

coreadm -e log

/bin/echo “0t${stamp}>Y\n

sar -a

sar -u

telnet 13 | grep ‘:’

uname -a

vmstat 10

who -b

ypcat hosts | sort -n -t. +0 -1 +1 -2 +2 -3 +3 -4


MSN空间完美搬家到新浪博客!

图文资讯
广告赞助商