Solaris 常用命令及对应的解释

网络整理 - 06-30


Debugging 
truss executable 
/* Trace doing of given command ( useful debugging ) */ 
truss f p <pid of a shell> 
/* Using multiple windows this can be used to trace setuid/setgid programs */ 
[ Back to Top ] 
Arp ethernet trouble shooting 
arp a  
/* Shows the ethernet address arp table */ 
arp d myhost 
/* Delete a stale ethernet entry for host myhost */ 

Disk Commands 
du k  
/* Reports disk space used in Kilobytes */ 
du sk  
/* Reports only total disk space used in Kilobytes */ 
du ad /var | sort nr 
/* Tells you how big the /var files are in reverse order */ 
fdformat d U 
/* Format diskette */ 
/usr/bin/iostat E 
/* Command to display drives statistics */ 
/bin/mount F hsfs o ro /dev/sr /cdrom 
/* Mount an ISO CDROM */ 
prtvtoc /dev/rdsk/ctds 
/* Disk geometry and partitioning info */ 
quot af 
/* How much space is used by users in kilobytes */ 

Driver Parameters 
ndd /dev/ip \? 
/* Shows IP variables in the kernel */ 
ndd /dev/ip ip_forwarding 
/* Tells you if forwarding is on (=) */ 
ndd set /dev/ip ip_forwarding  
/* Enables IP forwarding between interfaces */ 

File Manipulation 
dosunix | ascii <filename> 
/* Converts DOS file formats to Unix */ 
split 
/* Split files into pieces */ 
[vi] : %s/existing/new/g 
/* Search and Replace text in vi */ 
[vi] :set nu 
/* Set line numbers in vi */ 
[vi] :set ts=[num] 
/* Set tab stops in vi */ 

File System 
cat /dev/null > filename 
/* Zeros out the file without breaking pipe */ 
dd if=/dev/rdsk/ of=/dev/rdsk/ bs= 
/* Make a mirror image of your boot disk */ 
df k | grep dg| awk {print $} |xargs n umount 
/* Unmount all file systems in disk group dg */ 
fsck F ufs /dev/rdsk/ctds 
/* Check a UFS filesystem on ctds */ 
fsck F ufs y /dev/rdsk/ctds 
/* Check answering yes to all questions */ 
fsck F ufs o b= /dev/rdsk/ctds 
/* Check using an alternate super block */ 
gzip dc filetargz | tar xf  
/* Unpack targz files in place */ 
ls la | awk { print $  $ } | sort rn 
/* File sizes of current directory */ 
mount f pcfs /dev/dsk/cdp /export/dos 
/* Mount DOS fdisk partition from Solaris */ 
mount F ufs o rwremount / 
/* Used to remount root to make it writeable */ 
mount o remountlogging /spare 
/* Remount the ro file system rw and turn on ufs logging */ 
tar cvf filenametar 
/* Create a tape (tar) archive */ 
tar xvf filenametar 
/* Extract a tape (tar) archive */ 
tar cf | (cd /newdir ; tar xf ) 
/* Recursively copy files and their permissions */ 
/sbin/uadmin x x 
/* Syncs File Systems and Reboots systems fast */ 
zcat <patch_filetarZ | tar xvf  
/* Extract the patch_file that is a compressed tar file */ 

File Transfer 
put | tar cf filenametar 
/* Undocumented Feature of FTP */ 
find depth | cpio pdmv /path/tobe/copied/to 
/* Fast alternative to cp pr */ 
sendport 
/* Transferring large numbers of files within the same ftp control session */ 

General 
/usr/bin/catman w 
/* Create windex databases for man page directories */ 
mailx H u <username> 
/* List out mail headers for specified user */ 
set filec 
/* Set filecompletion for csh */ 

Hardware 
cfgadm 
/* Verify reconfigurable hardware resources */ 
mconfig prconf 
/* Print M hardware configuration */ 
mconfig depth | 
/* Sets the screen depth of your M graphics accelerator */ 
mconfig res video_mode 
/* Change the resolution of your M graphics accelerator */ 

Kernel 
/usr/sbin/modinfo 
/* Display kernel module information */ 
/usr/sbin/modload <module> 
/* Load a kernel module */ 
/usr/sbin/modunload i <module id> 
/* Unload a kernel module */ 
nm x /dev/ksyms | grep OBJ | more 
/* Tuneable kernel parameters */ 
/usr/sbin/sysdef 
/* Show system kernal tunable details */ 

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 hme 
/* 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 <ipaddress> 
/* Follow the route to the ipaddress */ 

Network/Tuning 
ifconfig eth mtu  
/* Change MTU of interface */ 
ifconfig eth netmask  
/* Add an Interface */ 
/sbin/ifconfig hme: inet xxxxx netmask broadcast xxxxxx 
/* Virtual Interfaces */ 
/sbin/ifconfig hme: up 
/* Bring virtual interface up */ 
/usr/sbin/ndd set /dev/hme adv_fdx_cap  
/* Nailling to Mbps */ 
ndd set /dev/ip ip_addrs_per_if  
/* To set more than virtual ip addresses */ 
ndd set /dev/tcp tcp_xmit_hiwat  
/* Increase TCPtransmitbuffers */ 
ndd set /dev/tcp tcp_recv_hiwat  
/* Increase TCPreceivebuffers */ 

Processes 
fuser uc /var 
/* Processes that are running from /var */ 
kill HUP `ps ef | grep [p]roccess | awk {print $}` 
/* HUP any related process in one step */ 
pfiles <pid> 
/* Shows processes current open files */ 
pkill n <name> 
/* Kill a process by name */ 
kill `ps ef | grep program_name | grep v grep | cut f d ` 
/* pkill for solaris */ 
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 <process name> 
/* Gives the full listing of the process (long listing) */ 
ps ef | grep i <string> | awk { print $ } 
/* Creates list of running PID by */ 
ps ef | grep v : | more 
/* Gives you a list of any process with CPU time more than : */ 
ps ef | more 
/* Show all processes running */ 
ps fu oracle|grep pmon 
/* See which instances of Oracle are running */ 
/usr/proc/bin/ptree <pid> 
/* Print the parent/child process tree of a process */ 
/usr/proc/bin/pwdx &l