Saturday, August 2, 2008

Solaris commands to remember

df -k
List mount points and space available on them.

du / | sort -rn | head -5
List 5 largest directories in the root (/) directory. Start here and drill down to find largest drive usage.

find . -name '*.xml'|xargs grep string
Search through a directory for files ending with xml extension that have the word string in them. The single quotes are important to avoid some parsing problems.

ls -alF
Preferred way to do a directory listing.

pargs -ae [pid]
List all the command line arguments for a process that the ps command won't show.

prstat -t -s rss
List users with processes running. This is the best way to find out the total memory usage. The RSS column lists how much physical memory is allocated to a process. The SIZE column lists how much total memory is allocated to a process.

prtconf
List physical memory as well as other stats about Solaris box.

ps -aef
Preferred way to list processes

/usr/ucb/ps -auxeww|grep [pid]
List full command line for a process

sar -g 5 5
See if virtual memory is being used