Comandos
- pfiles
Display the process current open files - df -k
Displays number of free disk blocks and files per file system - snoop
Capture network packages.
Eg.: To capture from interface eri1 from/to IP 10.9.29.186 and 172.30.61.35 port 20993 and store the packages on a file named file.cap:
snoop -o filecap -d eri1 10.9.29.186 172.30.61.35 port 20993
To read the captured file:
snoop -i file.cap -v
or
snoop -i file.cap -v port 20993 - Ethereal
Capture network packages
tethereal.real –i<devide> -R<filter> -w<output file name>
Eg.:
tethereal.real -ibge0 -R»sccp» -w5.cap - tshark
tshark -ibge0 -R»tcp.port==3869″ -S -wchargeid.cap -d tcp.port==3869,diameter
Define a protocol by port - xntp
Clock syncronization
To stop/start the xntpd process, as root:
/usr/lib/inet/xntpd stop
/usr/lib/inet/xntpd start
- /usr/platform/sun4u/sbin/prtdiag
Shows system Configuration (Solaris) - iostat -E
Show system devices such as disks, tapes, cd-rom - vmstat
Reports virtual memory statistics - swap -s
Shows the swap summary - /usr/bin/pagesize
Get the memory page size
Default 8192 - df –g
Get the Block size
Default 8192 - lsof –nl | grep TCP
or
1. cd /proc
2. Execute pfiles * | egrep «^[0-9]|sockname» > /tmp/pfiles.txt
Relates process with Sockets. Useful when you want to see which process is using which socket. - cfgadm
Configuration Administration including disks - /etc/vfstab
Disks and partitions - iostat
To Map between device names and physical disks
iostat -x | tail +3 | awk ‘{print $1}’ > /tmp/f0.txt.$$
iostat -nx |tail +3 | awk ‘{print «/dev/dsk/»$11}’ > /tmp/f1.txt.$$
paste -d= /tmp/f[01].txt.$$
rm /tmp/f[01].txt.$$ - prtconf
Shows System configuration, you can also use it to map between logical and physical disks
ls -l /dev/dsk/c0t1d0s2
replace sd with disk
prtconf -vp | grep «pci@780/pci@0/pci@9/scsi@0/disk@3» - prstat
Report active process statistics - prstat -c -t 10 5
Prustat will list the top processes sorted by CPU, Memory, Disk or Network utilization - swap -l
Swap Info - /usr/ucb/ps -auxwww
Show all process arguments this is particulary usefull on Solaris which does not show all the arguments with the regular ps command - find ./* -type d -prune -exec du -ks {} \;
Shows how much space is used per directory - find . -type d -print | sed -e ‘s;[^/]*/;|____;g;s;____|; |;g’
Show a Directory Tree - find -cmin +180 -cmin -300 -ls
The above find will retrieve all files that were modified after 180 minutes but less than 300 minutes
300min > <data> > 180min - dladm show-link
Shows information about the data-link interface such as status (UP/DOWN), Speed, Duplex, MTU, VLAN Tagged and statistics of network traffic (historical and real-time). - ndd
eg:
ndd /dev/tcp \?
ndd –get /dev/tcp \?
Shows a list of kernel parameters for the driver
ndd /dev/tcp tcp_time_wait_interval
Retrieves the value of this specific parameter - du -sh *
Shows disk usage only for one level. - tar –exclude=pictures/ -cvf 20140514_apache.tar *
Executes tar with exclusions - Sar –r 2 5
Get free memory - spray -c 100 -d 20 -l 1024 10.132.191.254
Test the reliability of your packet sizes. This command can tell you whether the network is delaying packets or dropping packets. - dlstat -t -i 5
eg: dlstat -t -r -i 1
User interface and tool for obtaining statistics on traffic on datalinks. - ipadm
Configure Network Tunables - ps -efo pid,user,lwp,pri,nice,vsz,rss,s,time,pcpu,fname | grep 2104
Show thread info of a process - cat x.txt >> net.out 2>&1
Redirect sterr and stout - kstat -p zfs:0:arcstats
Shows how the zfs arc is used - mdb -k</span><br><br>
- «The mdb utility is an extensible utility for low-level debugging and editing of the live operating system, operating system crash dumps, user processes, user process core dumps, and object files.»
- jrcmd
jrcmd 18358 print_memusage > /export/home/oracle/memusage.20150505_1135.txt
jrcmd 18358 start_flightrecording name=prodrecording duration=180s settings=default.jfs filename=/var/oracle/xxxx/xxxx61/managed_uni_diameter_2/server222_1135.jfr
jrcmd 18358 print_object_summary cutoff=100 > /export/home/oracle/objects.20150505_1135.txt
jrcmd 11742 print_threads nativestack=true
jrcmd 21168 print_object_summary cutoff=100
For Java Debugging - /usr/sbin/psrinfo -pv
Show physical processors and virtual - nc (netstat)
eg: nc -uvz 192.168.56.1 5090
this check the udp port 5090
Check if a port is open, TCP and UDP - sudo service sendmail restart
Restart the mail service - sendmail -Ac -vvv –q
Process the mail queue - /usr/local/apache2/bin/httpd -k restart
Restart the HTTP process - ps -ef | grep $USER|awk ‘{print $2}’| xargs -I ‘{}’ sh -c ‘echo examining process {}; pfiles {}| grep 80’
or
fuser 5556/tcp
or
netstat -nlp | grep 12960
or
netstat -tulpn
Map process id with network port - cat server.log | grep «2015-02-04» | awk ‘{ print substr( $0, length($0) – 50, length($0) ) }’
- cat server.log | perl -n -e ‘print substr $_,(length $_)-50,50;’
Take the last 50 chars of a line - du -sh ./*
iShow the usage per directory