Archive

Archive for the ‘Unix’ Category

Find the Biggest CPU Hog

March 27th, 2009 No comments

Is a certain process running your CPU right into the ground? How do you find said process without picking your way through the ps aux results? With this command:

ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'

…at which point you can kill it with sudo kill -9.

How do I know what services I have running?

August 21st, 2008 No comments

To get a list of all running processes, enter the command “ps auxw”. You might also want to try using “ps auxf” (or “ps auxfw” if the lines get truncated) – this prints everything in a nice tree format that may give you a better understanding of how and why things are running.

To get a complete listing of all listening network services using netstat, enter: netstat -altpu

You can also get similar information using lsof by entering: lsof -i | egrep -i ‘LISTEN|UDP’

Recover root password on Solaris

June 8th, 2008 No comments

Use the software cd 1 of 2 to recover root password:

1
2
3
4
5
6
7
8
9
10
11
12
boot cdrom -s from ok prompt
 
mkdir /tmp/a
 
mount /dev/dsk/c0t0d0s0 /tmp/a
 
cd /tmp/a/etc
 
TERM=vt100; export TERM
 
vi shadow

Delete passwd entry (13 chars) in the line for root.